From 961b20baea94bdb4d5673f05561c5f0ddfbc7779 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sun, 1 Mar 2020 17:05:36 +0100 Subject: [PATCH] [GH-8031] Bugfix: Get working again on nested embeddables in inherited embeddables. --- .../ORM/Mapping/ClassMetadataFactory.php | 4 --- .../ORM/Functional/Ticket/GH8031Test.php | 32 +++++++++++++++++-- 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php index f4015129e22..9f379739e6a 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php @@ -469,10 +469,6 @@ private function addInheritedEmbeddedClasses(ClassMetadata $subClass, ClassMetad private function addNestedEmbeddedClasses(ClassMetadata $subClass, ClassMetadata $parentClass, $prefix) { foreach ($subClass->embeddedClasses as $property => $embeddableClass) { - if (isset($embeddableClass['inherited'])) { - continue; - } - $embeddableMetadata = $this->getMetadataFor($embeddableClass['class']); $parentClass->mapEmbedded( diff --git a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php index 3ff242ac4b6..7b432ff4ac2 100644 --- a/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php +++ b/tests/Doctrine/Tests/ORM/Functional/Ticket/GH8031Test.php @@ -19,7 +19,7 @@ protected function setUp() public function testEntityIsFetched() { - $entity = new GH8031Invoice(new GH8031InvoiceCode(1, 2020)); + $entity = new GH8031Invoice(new GH8031InvoiceCode(1, 2020, new GH8031Nested(10))); $this->_em->persist($entity); $this->_em->flush(); $this->_em->clear(); @@ -38,6 +38,28 @@ public function testEntityIsFetched() } } +/** + * @Embeddable + */ +class GH8031Nested +{ + /** + * @Column(type="integer", name="number", length=6) + * @var int + */ + protected $number; + + public function __construct(int $number) + { + $this->number = $number; + } + + public function getNumber() : int + { + return $this->number; + } +} + /** * @Embeddable */ @@ -62,10 +84,16 @@ abstract class GH8031AbstractYearSequenceValue */ protected $year; - public function __construct(int $number, int $year) + /** + * @Embedded(class=GH8031Nested::class) + */ + protected $nested; + + public function __construct(int $number, int $year, GH8031Nested $nested) { $this->number = $number; $this->year = $year; + $this->nested = $nested; } public function getNumber() : int