Skip to content

Commit 5bf8140

Browse files
authored
Revert "Fix SchemaValidator with abstract child class in discriminator map (#9096)" (#9262)
This reverts commit bbb68d0.
1 parent 02a4e40 commit 5bf8140

File tree

2 files changed

+1
-41
lines changed

2 files changed

+1
-41
lines changed

lib/Doctrine/ORM/Tools/SchemaValidator.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ public function validateClass(ClassMetadataInfo $class)
239239
}
240240
}
241241

242-
if (! $class->isInheritanceTypeNone() && ! $class->isRootEntity() && ! $class->reflClass->isAbstract() && ! $class->isMappedSuperclass && array_search($class->name, $class->discriminatorMap, true) === false) {
242+
if (! $class->isInheritanceTypeNone() && ! $class->isRootEntity() && ! $class->isMappedSuperclass && array_search($class->name, $class->discriminatorMap, true) === false) {
243243
$ce[] = "Entity class '" . $class->name . "' is part of inheritance hierarchy, but is " .
244244
"not mapped in the root entity '" . $class->rootEntityName . "' discriminator map. " .
245245
'All subclasses must be listed in the discriminator map.';

tests/Doctrine/Tests/ORM/Tools/SchemaValidatorTest.php

-40
Original file line numberDiff line numberDiff line change
@@ -225,17 +225,6 @@ public function testMappedSuperclassNotPresentInDiscriminator(): void
225225

226226
$this->assertEquals([], $ce);
227227
}
228-
229-
/**
230-
* @group 9095
231-
*/
232-
public function testAbstractChildClassNotPresentInDiscriminator(): void
233-
{
234-
$class1 = $this->em->getClassMetadata(Issue9095AbstractChild::class);
235-
$ce = $this->validator->validateClass($class1);
236-
237-
$this->assertEquals([], $ce);
238-
}
239228
}
240229

241230
/**
@@ -267,35 +256,6 @@ class ChildEntity extends MappedSuperclassEntity
267256
{
268257
}
269258

270-
/**
271-
* @Entity
272-
* @InheritanceType("SINGLE_TABLE")
273-
* @DiscriminatorMap({"child" = Issue9095Child::class})
274-
*/
275-
abstract class Issue9095Parent
276-
{
277-
/**
278-
* @var mixed
279-
* @Id
280-
* @Column
281-
*/
282-
protected $key;
283-
}
284-
285-
/**
286-
* @Entity
287-
*/
288-
abstract class Issue9095AbstractChild extends Issue9095Parent
289-
{
290-
}
291-
292-
/**
293-
* @Entity
294-
*/
295-
class Issue9095Child extends Issue9095AbstractChild
296-
{
297-
}
298-
299259
/**
300260
* @Entity
301261
*/

0 commit comments

Comments
 (0)