Пример #1
0
 public function executeRemoves()
 {
     foreach ($this->unitOfWork->getObjectsToRemove() as $object) {
         $this->unitOfWork->getObjectPersister($object)->removeObject($object);
         $this->objectIdentityMap->detach($object);
         $this->eventDispatcher->dispatchLifecycleEvent(Events::postRemove, $object);
     }
 }
Пример #2
0
 /**
  * @param string $className
  * @param array  $data
  *
  * @return object
  */
 private function createObject($className, array $data)
 {
     $repository = $this->objectManager->getRepository($className);
     $object = $repository->create($className);
     if ($object instanceof NotifyPropertyChanged) {
         $object->addPropertyChangedListener($this);
     }
     $this->eventDispatcher->dispatchPreLoad($object, $data);
     $repository->hydrate($object, $data);
     $this->eventDispatcher->dispatchPostLoad($object);
     $this->objectIdentityMap->addToIdentityMap($object, $data);
     return $object;
 }