Пример #1
0
 /**
  * Is the passed-in object different from this history item's?
  * The object is compared to that previously set with {@link set_object()}. The objects must be the same. That
  * is, their ids must match or the function throws an exception. This function is used to track differences between
  * versions of an object, not to detect differences between objects.
  * @param AUDITABLE $obj
  * @access private
  */
 public function record_differences($obj)
 {
     $objects_are_same_or_new = $obj->exists() == $this->_object->exists() && $obj->id == $this->_object->id;
     $this->assert($objects_are_same_or_new, "Cannot compare two different objects (expected [{$this->_object->id}], got [{$obj->id}]", 'record_differences', 'HISTORY_ITEM');
     if (!$obj->exists()) {
         if (!isset($this->kind)) {
             $this->kind = $obj->history_item_kind_for_new();
         }
         $this->_is_new = true;
     } else {
         if (!isset($this->kind)) {
             $this->kind = History_item_updated;
         }
         $this->_record_differences($this->_object, $obj);
     }
 }