isDirty() 공개 메소드

Checks whether the given property was changed in the object since it was reconstituted. Returns TRUE for unknown objects in all cases!
public isDirty ( object $object, string $propertyName ) : boolean
$object object
$propertyName string
리턴 boolean
 /**
  *
  * @param string $identifier The object's identifier
  * @param object $object The object to work on
  * @param array $properties The properties to collect (as per class schema)
  * @param boolean $dirty A dirty flag that is passed by reference and set to TRUE if a dirty property was found
  * @return array
  */
 protected function collectProperties($identifier, $object, array $properties, &$dirty)
 {
     $propertyData = [];
     foreach ($properties as $propertyName => $propertyMetaData) {
         $propertyValue = $this->checkPropertyValue($object, $propertyName, $propertyMetaData);
         // handle all objects now, because even clean ones need to be traversed
         // as dirty checking is not recursive
         if ($propertyValue instanceof PersistenceMagicInterface) {
             if ($this->persistenceSession->isDirty($object, $propertyName)) {
                 $dirty = true;
                 $this->flattenValue($identifier, $object, $propertyName, $propertyMetaData, $propertyData);
             } else {
                 $this->persistObject($propertyValue, $identifier);
             }
         } elseif ($this->persistenceSession->isDirty($object, $propertyName)) {
             $dirty = true;
             $this->flattenValue($identifier, $object, $propertyName, $propertyMetaData, $propertyData);
         }
     }
     return $propertyData;
 }
 /**
  * @test
  */
 public function newObjectsAreConsideredDirty()
 {
     $session = new Persistence\Generic\Session();
     $this->assertTrue($session->isDirty(new \stdClass(), 'foo'));
 }