From 0cd0ae49a1c98ff0d606189cf95ebf6b91c6f419 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Thu, 16 Jun 2011 23:00:59 +0200 Subject: [PATCH] Fix regression introduced with DDC-1203,DDC-1204 patch --- .../ORM/Mapping/ClassMetadataFactory.php | 2 +- .../Mapping/BasicInheritanceMappingTest.php | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index 58f1cab8d..c036ba2f6 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -281,7 +281,7 @@ class ClassMetadataFactory implements ClassMetadataFactoryInterface throw MappingException::reflectionFailure($className, $e); } - if ($parent) { + if ($parent && ! $parent->isMappedSuperclass) { if ($parent->isIdGeneratorSequence()) { $class->setSequenceGeneratorDefinition($parent->sequenceGeneratorDefinition); } else if ($parent->isIdGeneratorTable()) { diff --git a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php index 9985bc241..a454141d3 100644 --- a/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php +++ b/tests/Doctrine/Tests/ORM/Mapping/BasicInheritanceMappingTest.php @@ -89,6 +89,17 @@ class BasicInheritanceMappingTest extends \Doctrine\Tests\OrmTestCase $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\HierachyE'); } + + /** + * @group DDC-1204 + * @group DDC-1203 + */ + public function testMappedSuperclassWithId() + { + $class = $this->_factory->getMetadataFor(__NAMESPACE__ . '\\SuperclassEntity'); + + $this->assertTrue(isset($class->fieldMappings['id'])); + } } class TransientBaseClass { @@ -189,4 +200,24 @@ class HierachyE extends HierachyBEntity { /** @Column(type="string") */ public $e; +} + +/** + * @Entity + */ +class SuperclassEntity extends SuperclassBase +{ + +} + +/** + * @MappedSuperclass + */ +abstract class SuperclassBase +{ + /** + * @Column(type="integer") @Id @GeneratedValue + * @var int + */ + public $id; } \ No newline at end of file