1
0
Fork 0
mirror of synced 2025-04-01 12:26:11 +03:00

DCOM-93 - Adjust ClassMetadataFactory#getClassParents() to use reflection service.

This commit is contained in:
Benjamin Eberlei 2012-01-02 15:30:25 +01:00
parent 87e0c69381
commit 9bdf9a9904
2 changed files with 32 additions and 2 deletions

View file

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

@ -1 +1 @@
Subproject commit 18d11e0a54f8c4e726940a3753e3c2949dbf1c02
Subproject commit cc04744bcf5a4743c46fae0487ac7a093a722856