1
0
mirror of synced 2025-02-20 06:03:15 +03:00

#1001 DDC-3005 - HydrationCompleteHandler static introspection cleanups, as well as memory and performance improvements

This commit is contained in:
Marco Pivetta 2015-01-13 00:50:05 +01:00
parent 8c54a65aa5
commit 730c2a81f7

View File

@ -19,7 +19,7 @@
namespace Doctrine\ORM\Internal;
use Doctrine\Common\Persistence\Mapping\ClassMetadata;
use Doctrine\ORM\Mapping\ClassMetadata;
use Doctrine\ORM\EntityManagerInterface;
use Doctrine\ORM\Event\LifecycleEventArgs;
use Doctrine\ORM\Event\ListenersInvoker;
@ -29,8 +29,6 @@ use Doctrine\ORM\Events;
* Class, which can handle completion of hydration cycle and produce some of tasks.
* In current implementation triggers deferred postLoad event.
*
* TODO Move deferred eager loading here
*
* @author Artur Eshenbrener <strate@yandex.ru>
* @since 2.5
*/
@ -71,7 +69,13 @@ final class HydrationCompleteHandler
*/
public function deferPostLoadInvoking(ClassMetadata $class, $entity)
{
$this->deferredPostLoadInvocations[] = array($class, $entity);
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postLoad);
if ($invoke === ListenersInvoker::INVOKE_NONE) {
return;
}
$this->deferredPostLoadInvocations[] = array($class, $invoke, $entity);
}
/**
@ -87,16 +91,13 @@ final class HydrationCompleteHandler
*/
private function invokeAllDeferredPostLoadEvents()
{
$toInvoke = $this->deferredPostLoadInvocations;
$toInvoke = $this->deferredPostLoadInvocations;
$this->deferredPostLoadInvocations = array();
foreach ($toInvoke as $classAndEntity) {
list($class, $entity) = $classAndEntity;
list($class, $invoke, $entity) = $classAndEntity;
$invoke = $this->listenersInvoker->getSubscribedSystems($class, Events::postLoad);
if ($invoke !== ListenersInvoker::INVOKE_NONE) {
$this->listenersInvoker->invoke($class, Events::postLoad, $entity, new LifecycleEventArgs($entity, $this->em), $invoke);
}
$this->listenersInvoker->invoke($class, Events::postLoad, $entity, new LifecycleEventArgs($entity, $this->em), $invoke);
}
}
}