diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index f8c3f7484..62f81939e 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -141,13 +141,17 @@ class ClassMetadataFactory extends AbstractClassMetadataFactory $this->completeIdGeneratorMapping($class); } - foreach ($class->embeddedClasses as $property => $embeddableClass) { - if (isset($embeddableClass['inherited'])) { - continue; - } + if (!$class->isMappedSuperclass) { - $embeddableMetadata = $this->getMetadataFor($embeddableClass['class']); - $class->inlineEmbeddable($property, $embeddableMetadata); + foreach ($class->embeddedClasses as $property => $embeddableClass) { + + if (isset($embeddableClass['inherited'])) { + continue; + } + + $embeddableMetadata = $this->getMetadataFor($embeddableClass['class']); + $class->inlineEmbeddable($property, $embeddableMetadata); + } } if ($parent && $parent->isInheritanceTypeSingleTable()) { diff --git a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php index 8820fe501..4e34004b8 100644 --- a/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php +++ b/tests/Doctrine/Tests/ORM/Functional/ValueObjectsTest.php @@ -17,6 +17,8 @@ class ValueObjectsTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC93Address'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC93Vehicle'), $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC93Car'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC3027Animal'), + $this->_em->getClassMetadata(__NAMESPACE__ . '\DDC3027Dog'), )); } catch(\Exception $e) { } @@ -212,6 +214,15 @@ class ValueObjectsTest extends \Doctrine\Tests\OrmFunctionalTestCase $this->assertEquals($expectedColumnName, $actualColumnName); } + + public function testInlineEmbeddableInMappedSuperClass() + { + $isFieldMapped = $this->_em + ->getClassMetadata(__NAMESPACE__ . '\DDC3027Dog') + ->hasField('address.street'); + + $this->assertTrue($isFieldMapped); + } } @@ -396,3 +407,22 @@ class DDC3028Id $this->id = $id; } } + +/** + * @MappedSuperclass + */ +abstract class DDC3027Animal +{ + /** @Id @GeneratedValue(strategy = "AUTO") @Column(type = "integer") */ + public $id; + + /** @Embedded(class = "DDC93Address") */ + public $address; +} + +/** + * @Entity + */ +class DDC3027Dog extends DDC3027Animal +{ +}