_options = Doctrine_Lib::arrayDeepMerge($this->_options, $tmpOptions); } public function setTableDefinition() { foreach($this->_options['RelationsWithVersion'] AS $foreignModel=>$options) { $this->hasColumn($options['local_version'], 'integer', null, array('type' => 'integer')); } } public function setRelationWithVersion($relationName, $record) { if (!isset($this->_options['RelationsWithVersion'][$relationName])) throw new Exception("RelationWithVersion for '{$relationName}' is not set."); $option = $this->_options['RelationsWithVersion'][$relationName]; if (get_class($record) != $option['class']) throw new Exception("RelationWithVersion for '{$relationName}' only accept object of '{$option['classs']}' class."); $invoker = $this->getInvoker(); $invoker->$option['local'] = $record->$option['foreign']; $invoker->$option['local_version'] = $record->$option['foreign_version']; } public function getRelationWithVersion($relationName) { $option = $this->_options['RelationsWithVersion'][$relationName]; $propertyName = 'RWV_objects'; $invoker = $this->getInvoker(); $record = Doctrine::getTable($relationName)->find($invoker->$option['local']); $record->revert($invoker->$option['local_version']); return $record; } } ?>