From ac175d2c406fd7790cc032e94c819e441ca3a5db Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 20 Mar 2011 12:35:52 +0100 Subject: [PATCH] [DDC-1068] Fix case-sensitivity problems of first loading of Metadata. --- lib/Doctrine/ORM/Mapping/ClassMetadata.php | 2 +- tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadata.php b/lib/Doctrine/ORM/Mapping/ClassMetadata.php index 222b38877..2465f1c3a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadata.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadata.php @@ -63,10 +63,10 @@ class ClassMetadata extends ClassMetadataInfo */ public function __construct($entityName) { - parent::__construct($entityName); $this->reflClass = new ReflectionClass($entityName); $this->namespace = $this->reflClass->getNamespaceName(); $this->table['name'] = $this->reflClass->getShortName(); + parent::__construct($this->reflClass->getName()); // do not use $entityName, possible case-problems } /** diff --git a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php index 74889c0ae..9f3bc357e 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/ClassMetadataTest.php @@ -446,4 +446,14 @@ class ClassMetadataTest extends \Doctrine\Tests\OrmTestCase 'query' => 'SELECT u FROM __CLASS__ u WHERE u.id = ?1' )); } + + /** + * @group DDC-1068 + */ + public function testClassCaseSensitivity() + { + $user = new \Doctrine\Tests\Models\CMS\CmsUser(); + $cm = new ClassMetadata('DOCTRINE\TESTS\MODELS\CMS\CMSUSER'); + $this->assertEquals('Doctrine\Tests\Models\CMS\CmsUser', $cm->name); + } }