Model/Behavior/RevisionBehavior.php
public function revertTo(Model $Model, $versionId) {
		if (!$Model->id) {
			trigger_error('RevisionBehavior: Model::id must be set', E_USER_WARNING);
			return false;
		}
		if (!$Model->ShadowModel) {
			trigger_error('RevisionBehavior: ShadowModel doesnt exist.', E_USER_WARNING);
			return false;
		}
		$data = $Model->ShadowModel->find('first', array('conditions' => array('version_id' => $versionId)));
		if (!$data) {
			return false;
		}
		foreach ($Model->getAssociated('hasAndBelongsToMany') as $assocAlias) {
			if (isset($Model->ShadowModel->_schema[$assocAlias])) {
				$data[$assocAlias][$assocAlias] = explode(',', $data[$Model->alias][$assocAlias]);
			}
		}
		return (bool)$Model->save($data);
	}
public function revertTo(Model $Model, $versionId) {
		if (!$Model->id) {
			trigger_error('RevisionBehavior: Model::id must be set', E_USER_WARNING);
			return false;
		}
		if (!$Model->ShadowModel) {
			trigger_error('RevisionBehavior: ShadowModel doesnt exist.', E_USER_WARNING);
			return false;
		}
		$data = $Model->ShadowModel->find('first', array('conditions' => array('version_id' => $versionId)));
		if (!$data) {
			return false;
		}
		foreach ($Model->getAssociated('hasAndBelongsToMany') as $assocAlias) {
			if (isset($Model->ShadowModel->_schema[$assocAlias])) {
				$data[$assocAlias][$assocAlias] = explode(',', $data[$Model->alias][$assocAlias]);
			}
		}
		return (bool)$Model->save($data);
	}
public function revertTo ( Model $ Model , $ versionId ) { if ( ! $ Model -> id ) { trigger_error ( 'RevisionBehavior: Model::id must be set' , E_USER_WARNING ) ; return false ; } if ( ! $ Model -> ShadowModel ) { trigger_error ( 'RevisionBehavior: ShadowModel doesnt exist.' , E_USER_WARNING ) ; return false ; } $ data = $ Model -> ShadowModel -> find ( 'first' , array ( 'conditions' => array ( 'version_id' => $ versionId ) ) ) ; if ( ! $ data ) { return false ; } foreach ( $ Model -> getAssociated ( 'hasAndBelongsToMany' ) as $ assocAlias ) { if ( isset ( $ Model -> ShadowModel -> _schema [ $ assocAlias ] ) ) { $ data [ $ assocAlias ] [ $ assocAlias ] = explode ( ',' , $ data [ $ Model -> alias ] [ $ assocAlias ] ) ; } } return ( bool ) $ Model -> save ( $ data ) ; }
Revert current Model->id to the given revision id
Will return false if version id is invalid or save fails

@example $this->Post->id = 3; $this->Post->revertTo(12);
@param object $Model
@param int $versionId
@return bool Success
Revert current Model - > id to the given revision id Will return false if version id is invalid or save fails