propertyChanged() public method

Notifies this UnitOfWork of a property change in an entity.
public propertyChanged ( object $entity, string $propertyName, mixed $oldValue, mixed $newValue )
$entity object The entity that owns the property.
$propertyName string The name of the property that changed.
$oldValue mixed The old value of the property.
$newValue mixed The new value of the property.
 /**
  * Flush for update
  *
  * @param object $entity
  * @param \Doctrine\ORM\EntityManager $entityManager
  * @param \Doctrine\ORM\UnitOfWork $unitOfWork
  */
 protected function onFlushForUpdates(&$entity, EntityManager &$entityManager, UnitOfWork &$unitOfWork)
 {
     $className = get_class($entity);
     $this->initializeAnnotationsForEntity($className);
     if (count(self::$storedProperties[$className]['annotations']) > 0) {
         foreach (self::$storedProperties[$className]['annotations'] as $propertyName => &$annotations) {
             /* @var $annotation Traceable */
             foreach ($annotations as $annotation) {
                 $run = $annotation->on === 'update';
                 if ($annotation->on === 'change') {
                     $changeSet = $unitOfWork->getEntityChangeSet($entity);
                     if (isset($changeSet[$annotation->field])) {
                         $type = $this->getPropertyType($className, $annotation->field);
                         $values = $annotation->getFieldValues($type, $entity);
                         $run = count($values) === 0 || in_array($changeSet[$annotation->field][1], $values);
                     }
                 }
                 if ($run) {
                     list($oldValue, $value) = $this->updateEntityPropertyValue($entity, $className, $propertyName, $annotation);
                     $entityManager->persist($entity);
                     $unitOfWork->propertyChanged($entity, $propertyName, $oldValue, $value);
                     $unitOfWork->scheduleExtraUpdate($entity, array($propertyName => array($oldValue, $value)));
                     break;
                 }
             }
         }
     }
 }
 /**
  * Updates a field
  *
  * @param ORM\UnitOfWork $uow
  * @param mixed $object
  * @param ORM\Mapping\ClassMetadata $classMetadata
  * @param string $field
  */
 private function updateField(ORM\UnitOfWork $uow, $object, ORM\Mapping\ClassMetadata $classMetadata, $field)
 {
     $property = $classMetadata->getReflectionProperty($field);
     $oldValue = $property->getValue($object);
     $newValue = $this->getDateValue($classMetadata, $field);
     $property->setValue($object, $newValue);
     $uow->propertyChanged($object, $field, $oldValue, $newValue);
     $uow->scheduleExtraUpdate($object, [$field => [$oldValue, $newValue]]);
 }
 /**
  * Serialize data of WorkflowItem
  *
  * @param WorkflowItem $workflowItem
  * @param UnitOfWork $uow
  */
 protected function serialize(WorkflowItem $workflowItem, UnitOfWork $uow)
 {
     if ($workflowItem->getData()->isModified()) {
         $oldValue = $workflowItem->getSerializedData();
         $this->serializer->setWorkflowName($workflowItem->getWorkflowName());
         $serializedData = $this->serializer->serialize($workflowItem->getData(), $this->format);
         $workflowItem->setSerializedData($serializedData);
         $uow->propertyChanged($workflowItem, 'serializedData', $oldValue, $serializedData);
     }
 }