Skip to content

Commit 2d4c8b7

Browse files
committed
Fix condition when ID generator setting shall have defaults added
We need to fill in the defaults only for the class where the ID definition occurs for the first (only) time.
1 parent 956fff7 commit 2d4c8b7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,10 @@ protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonS
135135
throw MappingException::reflectionFailure($class->getName(), $e);
136136
}
137137

138-
$this->completeIdGeneratorMapping($class);
138+
// Complete id generator mapping when the generator was declared/added in this class
139+
if ($class->identifier && (! $parent || ! $parent->identifier)) {
140+
$this->completeIdGeneratorMapping($class);
141+
}
139142

140143
if (! $class->isMappedSuperclass) {
141144
foreach ($class->embeddedClasses as $property => $embeddableClass) {

tests/Doctrine/Tests/ORM/Functional/Ticket/GH10454Test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
use Doctrine\Tests\OrmTestCase;
1010
use Generator;
1111

12+
use function get_parent_class;
13+
use function method_exists;
14+
1215
class GH10454Test extends OrmTestCase
1316
{
1417
/**

0 commit comments

Comments
 (0)