From 94928c5dd8e7c18ba7f09c6e650dc13b1d4a0733 Mon Sep 17 00:00:00 2001 From: "Jonathan H. Wage" Date: Fri, 30 Apr 2010 12:27:52 -0400 Subject: [PATCH] [DDC-552] Fixing issue with getReflectionClass() not existing on ClassMetadataInfo when it is required by AnnotationDriver --- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 17 -------------- .../ORM/Mapping/ClassMetadataInfo.php | 22 +++++++++++++++++++ 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 18558c01a..48bbc996a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -41,13 +41,6 @@ use ReflectionClass, ReflectionProperty; */ class ClassMetadata extends ClassMetadataInfo { - /** - * The ReflectionClass instance of the mapped class. - * - * @var ReflectionClass - */ - public $reflClass; - /** * The ReflectionProperty instances of the mapped class. * @@ -76,16 +69,6 @@ class ClassMetadata extends ClassMetadataInfo $this->table['name'] = $this->reflClass->getShortName(); } - /** - * Gets the ReflectionClass instance of the mapped class. - * - * @return ReflectionClass - */ - public function getReflectionClass() - { - return $this->reflClass; - } - /** * Gets the ReflectionPropertys of the mapped class. * diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index ac481c48f..d1f13f002 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -19,6 +19,8 @@ namespace Doctrine\ORM\Mapping; +use ReflectionClass; + /** * A ClassMetadata instance holds all the object-relational mapping metadata * of an entity and it's associations. @@ -366,6 +368,13 @@ class ClassMetadataInfo */ public $versionField; + /** + * The ReflectionClass instance of the mapped class. + * + * @var ReflectionClass + */ + public $reflClass; + /** * Initializes a new ClassMetadata instance that will hold the object-relational mapping * metadata of the class with the given name. @@ -378,6 +387,19 @@ class ClassMetadataInfo $this->rootEntityName = $entityName; } + /** + * Gets the ReflectionClass instance of the mapped class. + * + * @return ReflectionClass + */ + public function getReflectionClass() + { + if ( ! $this->reflClass) { + $this->reflClass = new ReflectionClass($entityName); + } + return $this->reflClass; + } + /** * Sets the change tracking policy used by this class. *