/**
  * Restores a single property marked as versionable
  *
  * @param interface_versionable|class_model $objObject
  * @param class_date $objTimestamp
  * @param $strProperty
  */
 public function restoreProperty(interface_versionable $objObject, class_date $objTimestamp, $strProperty)
 {
     //there are a few properties not to change
     if ($strProperty == "intRecordStatus") {
         return;
     }
     //load the value from the changelog
     $strValue = $this->getValueForDate($objObject->getSystemid(), $strProperty, $objTimestamp);
     if ($strValue === false) {
         $strValue = null;
     }
     //remove the system-id temporary to avoid callbacks and so on
     $strSystemid = $objObject->getSystemid();
     $objObject->unsetSystemid();
     //all prerequisites match, start creating query
     $objReflection = new class_reflection($objObject);
     $strSetter = $objReflection->getSetter($strProperty);
     if ($strSetter !== null) {
         call_user_func(array($objObject, $strSetter), $strValue);
     }
     $objObject->setSystemid($strSystemid);
 }
 /**
  * Builds the change-array based on the old- and new values
  *
  * @param interface_versionable|class_root $objSourceModel
  * @param bool $bitUseInitValues
  *
  * @return array
  */
 private function createChangeArray($objSourceModel, $bitUseInitValues = false)
 {
     $arrOldValues = $this->getOldValuesForSystemid($objSourceModel->getSystemid());
     if ($bitUseInitValues) {
         $arrOldValues = $this->getInitValuesForSystemid($objSourceModel->getSystemid());
     }
     //this are now the new ones
     $arrNewValues = $this->readVersionableProperties($objSourceModel);
     if ($arrOldValues == null) {
         $arrOldValues = array();
     }
     if ($arrNewValues == null) {
         $arrNewValues = array();
     }
     $arrReturn = array();
     foreach ($arrNewValues as $strPropertyName => $objValue) {
         $arrReturn[] = array("property" => $strPropertyName, "oldvalue" => isset($arrOldValues[$strPropertyName]) ? $arrOldValues[$strPropertyName] : "", "newvalue" => isset($arrNewValues[$strPropertyName]) ? $arrNewValues[$strPropertyName] : "");
     }
     return $arrReturn;
 }