#470 DDC-54 DDC-3005 - reverting hydrator changes, as patch DDC-3005 already deals with the issue
This commit is contained in:
parent
aa4796cd0d
commit
b1144e74ea
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user