diff --git a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php index e2d119f66..2d225c3d1 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/ObjectHydrator.php @@ -77,18 +77,11 @@ class ObjectHydrator extends AbstractHydrator */ private $existingCollections = array(); - /** - * @var \Doctrine\ORM\Event\PostLoadEventDispatcher - */ - private $postLoadEventDispatcher; - /** * {@inheritdoc} */ protected function prepare() { - $this->postLoadEventDispatcher = new PostLoadEventDispatcher($this->_em, $this->_hints); - if ( ! isset($this->_hints[UnitOfWork::HINT_DEFEREAGERLOAD])) { $this->_hints[UnitOfWork::HINT_DEFEREAGERLOAD] = true; } @@ -154,8 +147,6 @@ class ObjectHydrator extends AbstractHydrator $this->existingCollections = $this->resultPointers = array(); - unset($this->postLoadEventDispatcher); - if ($eagerLoad) { $this->_uow->triggerEagerLoads(); } @@ -179,8 +170,6 @@ class ObjectHydrator extends AbstractHydrator $coll->takeSnapshot(); } - $this->postLoadEventDispatcher->dispatchEnqueuedPostLoadEvents(); - return $result; } @@ -281,13 +270,7 @@ class ObjectHydrator extends AbstractHydrator $this->_hints['fetchAlias'] = $dqlAlias; - $created = false; - $entity = $this->_uow->createEntity($className, $data, $this->_hints, $created); - if ($created) { - $this->postLoadEventDispatcher->dispatchPostLoad($entity); - } - - return $entity; + return $this->_uow->createEntity($className, $data, $this->_hints); } /** diff --git a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php index 6254d35b4..20c75ad30 100644 --- a/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php +++ b/lib/Doctrine/ORM/Internal/Hydration/SimpleObjectHydrator.php @@ -23,10 +23,6 @@ use PDO; use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Mapping\ClassMetadata; use Doctrine\ORM\Query; -use Doctrine\ORM\Events; -use Doctrine\ORM\Event\LifecycleEventArgs; -use Doctrine\ORM\Event\ListenersInvoker; -use Doctrine\ORM\Event\PostLoadEventDispatcher; class SimpleObjectHydrator extends AbstractHydrator { @@ -35,23 +31,11 @@ class SimpleObjectHydrator extends AbstractHydrator */ private $class; - /** - * @var \Doctrine\ORM\Event\PostLoadEventDispatcher - */ - private $postLoadEventDispatcher; - - /** - * @var array - */ - private $hydratedObjects = array(); - /** * {@inheritdoc} */ protected function prepare() { - $this->postLoadEventDispatcher = new PostLoadEventDispatcher($this->_em, $this->_hints); - if (count($this->_rsm->aliasMap) !== 1) { throw new \RuntimeException("Cannot use SimpleObjectHydrator with a ResultSetMapping that contains more than one object result."); } @@ -87,21 +71,9 @@ class SimpleObjectHydrator extends AbstractHydrator $this->_em->getUnitOfWork()->triggerEagerLoads(); - $this->postLoadEventDispatcher->dispatchEnqueuedPostLoadEvents(); - return $result; } - /** - * {@inheritdoc} - */ - protected function cleanup() - { - parent::cleanup(); - - unset($this->postLoadEventDispatcher); - } - /** * {@inheritdoc} */ @@ -169,11 +141,7 @@ class SimpleObjectHydrator extends AbstractHydrator } $uow = $this->_em->getUnitOfWork(); - $created = false; - $entity = $uow->createEntity($entityName, $data, $this->_hints, $created); - if ($created) { - $this->postLoadEventDispatcher->dispatchPostLoad($entity); - } + $entity = $uow->createEntity($entityName, $data, $this->_hints); $result[] = $entity; }