private function executeDeletions(ClassMetadata $class, array $options = array())
{
$hasLifecycleCallbacks = isset($class->lifecycleCallbacks[Events::postRemove]);
$hasListeners = $this->evm->hasListeners(Events::postRemove);
$className = $class->name;
$persister = $this->getXmlEntityPersister($className);
foreach ($this->entityDeletions as $oid => $xmlEntity) {
if (get_class($xmlEntity) == $className || $xmlEntity instanceof Proxy && $xmlEntity instanceof $className) {
// if ( ! $class->isEmbeddedDocument) {
$persister->delete($xmlEntity, $options);
// }
unset($this->entityDeletions[$oid], $this->entityIdentifiers[$oid], $this->originalEntityData[$oid]);
// // Clear snapshot information for any referenced PersistentCollection
// // http://www.doctrine-project.org/jira/browse/MODM-95
// foreach ($class->fieldMappings as $fieldMapping) {
// if (isset($fieldMapping['type']) && $fieldMapping['type'] === 'many') {
// $value = $class->reflFields[$fieldMapping['fieldName']]->getValue($document);
// if ($value instanceof PersistentCollection) {
// $value->clearSnapshot();
// }
// }
// }
// Xml Entity with this $oid after deletion treated as NEW, even if the $oid
// is obtained by a new document because the old one went out of scope.
$this->entityStates[$oid] = self::STATE_NEW;
if ($hasLifecycleCallbacks) {
$class->invokeLifecycleCallbacks(Events::postRemove, $xmlEntity);
}
if ($hasListeners) {
$this->evm->dispatchEvent(Events::postRemove, new Event\LifecycleEventArgs($xmlEntity, $this->xem));
}
// $this->cascadePostRemove($class, $xmlEntity);
}
}
}