#1272 DDC-2704 - using the property getter utility rather than metadata API when fetching reflection properties for a class
This commit is contained in:
parent
05a8e1c77d
commit
d952077d04
@ -19,8 +19,10 @@
|
|||||||
|
|
||||||
namespace Doctrine\ORM;
|
namespace Doctrine\ORM;
|
||||||
|
|
||||||
|
use Doctrine\Common\Persistence\Mapping\RuntimeReflectionService;
|
||||||
use Doctrine\DBAL\LockMode;
|
use Doctrine\DBAL\LockMode;
|
||||||
use Doctrine\ORM\Internal\HydrationCompleteHandler;
|
use Doctrine\ORM\Internal\HydrationCompleteHandler;
|
||||||
|
use Doctrine\ORM\Mapping\Reflection\ReflectionPropertiesGetter;
|
||||||
use Exception;
|
use Exception;
|
||||||
use InvalidArgumentException;
|
use InvalidArgumentException;
|
||||||
use UnexpectedValueException;
|
use UnexpectedValueException;
|
||||||
@ -283,6 +285,11 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
*/
|
*/
|
||||||
private $hydrationCompleteHandler;
|
private $hydrationCompleteHandler;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var ReflectionPropertiesGetter
|
||||||
|
*/
|
||||||
|
private $reflectionPropertiesGetter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes a new UnitOfWork instance, bound to the given EntityManager.
|
* Initializes a new UnitOfWork instance, bound to the given EntityManager.
|
||||||
*
|
*
|
||||||
@ -290,12 +297,13 @@ class UnitOfWork implements PropertyChangedListener
|
|||||||
*/
|
*/
|
||||||
public function __construct(EntityManagerInterface $em)
|
public function __construct(EntityManagerInterface $em)
|
||||||
{
|
{
|
||||||
$this->em = $em;
|
$this->em = $em;
|
||||||
$this->evm = $em->getEventManager();
|
$this->evm = $em->getEventManager();
|
||||||
$this->listenersInvoker = new ListenersInvoker($em);
|
$this->listenersInvoker = new ListenersInvoker($em);
|
||||||
$this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled();
|
$this->hasCache = $em->getConfiguration()->isSecondLevelCacheEnabled();
|
||||||
$this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory());
|
$this->identifierFlattener = new IdentifierFlattener($this, $em->getMetadataFactory());
|
||||||
$this->hydrationCompleteHandler = new HydrationCompleteHandler($this->listenersInvoker, $em);
|
$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));
|
$class = $this->em->getClassMetadata(get_class($entity));
|
||||||
|
|
||||||
foreach ($class->getAllReflectionProperties() as $prop) {
|
foreach ($this->reflectionPropertiesGetter->getProperties($class->name) as $prop) {
|
||||||
$name = $prop->name;
|
$name = $prop->name;
|
||||||
|
|
||||||
$prop->setAccessible(true);
|
$prop->setAccessible(true);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user