From d952077d04cd40cfd2e7e1d0206a58629e6324ca Mon Sep 17 00:00:00 2001 From: Marco Pivetta Date: Sat, 24 Jan 2015 14:30:40 +0100 Subject: [PATCH] #1272 DDC-2704 - using the property getter utility rather than metadata API when fetching reflection properties for a class --- lib/Doctrine/ORM/UnitOfWork.php | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/Doctrine/ORM/UnitOfWork.php b/lib/Doctrine/ORM/UnitOfWork.php index a09bf1cc1..8f82aa96f 100644 --- a/lib/Doctrine/ORM/UnitOfWork.php +++ b/lib/Doctrine/ORM/UnitOfWork.php @@ -19,8 +19,10 @@ namespace Doctrine\ORM; +use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService; use Doctrine\DBAL\LockMode; use Doctrine\ORM\Internal\HydrationCompleteHandler; +use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter; use Exception; use InvalidArgumentException; use UnexpectedValueException; @@ -283,6 +285,11 @@ class UnitOfWork implements PropertyChangedListener */ private $hydrationCompleteHandler; + /** + * @var ReflectionPropertiesGetter + */ + private $reflectionPropertiesGetter; + /** * Initializes a new UnitOfWork instance, bound to the given EntityManager. * @@ -290,12 +297,13 @@ class UnitOfWork implements PropertyChangedListener */ public function __construct(EntityManagerInterface $em) { - $this->em = $em; - $this->evm = $em->getEventManager(); - $this->listenersInvoker = new ListenersInvoker($em); - $this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled(); - $this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory()); - $this->hydrationCompleteHandler = new HydrationCompleteHandler($this->listenersInvoker, $em); + $this->em = $em; + $this->evm = $em->getEventManager(); + $this->listenersInvoker = new ListenersInvoker($em); + $this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled(); + $this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory()); + $this->hydrationCompleteHandler = new HydrationCompleteHandler($this->listenersInvoker, $em); + $this->reflectionPropertiesGetter = new ReflectionPropertiesGetter(new RuntimeReflectionService()); } /** @@ -3352,7 +3360,7 @@ class UnitOfWork implements PropertyChangedListener { $class = $this->em->getClassMetadata(get_class($entity)); - foreach ($class->getAllReflectionProperties() as $prop) { + foreach ($this->reflectionPropertiesGetter->getProperties($class->name) as $prop) { $name = $prop->name; $prop->setAccessible(true);