1
0
mirror of synced 2025-03-22 07:53:49 +03:00

#1272 DDC-2704 - using the property getter utility rather than metadata API when fetching reflection properties for a class

This commit is contained in:
Marco Pivetta 2015-01-24 14:30:40 +01:00
parent 05a8e1c77d
commit d952077d04

View File

@ -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);