/** * Executes all entity deletions for entities of the specified type. * * @param Doctrine\ORM\Mapping\ClassMetadata $class */ private function _executeDeletions($class) { $className = $class->name; $persister = $this->getEntityPersister($className); $hasLifecycleCallbacks = isset($class->lifecycleCallbacks[Events::postRemove]); $hasListeners = $this->_evm->hasListeners(Events::postRemove); foreach ($this->_entityDeletions as $oid => $entity) { if (get_class($entity) == $className || $entity instanceof Proxy && $entity instanceof $className) { $persister->delete($entity); unset($this->_entityDeletions[$oid], $this->_entityIdentifiers[$oid], $this->_originalEntityData[$oid]); // Entity with this $oid after deletion treated as NEW, even if the $oid // is obtained by a new entity because the old one went out of scope. $this->_entityStates[$oid] = self::STATE_NEW; if ($hasLifecycleCallbacks) { $class->invokeLifecycleCallbacks(Events::postRemove, $entity); } if ($hasListeners) { $this->_evm->dispatchEvent(Events::postRemove, new LifecycleEventArgs($entity, $this->_em)); } } } }