DCOM-93 - Adjust ClassMetadataFactory#getClassParents() to use reflection service.
This commit is contained in:
parent
87e0c69381
commit
9bdf9a9904
2 changed files with 32 additions and 2 deletions
|
@ -24,6 +24,8 @@ use ReflectionException,
|
|||
Doctrine\ORM\EntityManager,
|
||||
Doctrine\DBAL\Platforms,
|
||||
Doctrine\ORM\Events,
|
||||
Doctrine\Common\Persistence\Mapping\RuntimeReflectionService,
|
||||
Doctrine\Common\Persistence\Mapping\ReflectionService,
|
||||
Doctrine\Common\Persistence\Mapping\ClassMetadataFactory as ClassMetadataFactoryInterface;
|
||||
|
||||
/**
|
||||
|
@ -74,6 +76,11 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
|||
*/
|
||||
private $initialized = false;
|
||||
|
||||
/**
|
||||
* @var ReflectionException
|
||||
*/
|
||||
private $reflectionService;
|
||||
|
||||
/**
|
||||
* @param EntityManager $$em
|
||||
*/
|
||||
|
@ -220,7 +227,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
|||
{
|
||||
// Collect parent classes, ignoring transient (not-mapped) classes.
|
||||
$parentClasses = array();
|
||||
foreach (array_reverse(class_parents($name)) as $parentClass) {
|
||||
foreach (array_reverse($this->getReflectionService()->getParentClasses($name)) as $parentClass) {
|
||||
if ( ! $this->driver->isTransient($parentClass)) {
|
||||
$parentClasses[] = $parentClass;
|
||||
}
|
||||
|
@ -533,4 +540,27 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface
|
|||
|
||||
return $this->driver->isTransient($class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get reflectionService.
|
||||
*
|
||||
* @return \Doctrine\Common\Persistence\Mapping\ReflectionService
|
||||
*/
|
||||
public function getReflectionService()
|
||||
{
|
||||
if ($this->reflectionService === null) {
|
||||
$this->reflectionService = new RuntimeReflectionService();
|
||||
}
|
||||
return $this->reflectionService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set reflectionService.
|
||||
*
|
||||
* @param reflectionService the value to set.
|
||||
*/
|
||||
public function setReflectionService(ReflectionService $reflectionService)
|
||||
{
|
||||
$this->reflectionService = $reflectionService;
|
||||
}
|
||||
}
|
||||
|
|
2
lib/vendor/doctrine-common
vendored
2
lib/vendor/doctrine-common
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 18d11e0a54f8c4e726940a3753e3c2949dbf1c02
|
||||
Subproject commit cc04744bcf5a4743c46fae0487ac7a093a722856
|
Loading…
Add table
Reference in a new issue