From 9bdf9a99040637da541a933cbb5b5a2ab617c911 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Mon, 2 Jan 2012 15:30:25 +0100 Subject: [PATCH] DCOM-93 - Adjust ClassMetadataFactory#getClassParents() to use reflection service. --- .../ORM/Mapping/ClassMetadataFactory.php | 32 ++++++++++++++++++- lib/vendor/doctrine-common | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index bf802ecf9..6471df0fd 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -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; + } } diff --git a/lib/vendor/doctrine-common b/lib/vendor/doctrine-common index 18d11e0a5..cc04744bc 160000 --- a/lib/vendor/doctrine-common +++ b/lib/vendor/doctrine-common @@ -1 +1 @@ -Subproject commit 18d11e0a54f8c4e726940a3753e3c2949dbf1c02 +Subproject commit cc04744bcf5a4743c46fae0487ac7a093a722856