mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
2.14.2: Entity Inheritance (at least STI) with intermediate abstract class is broken #7133
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @ghost on GitHub (Apr 13, 2023).
BC Break Report
The Single Table Inheritance Entity Inheritance is defined in your documentation with
but will fail on EntityManager::find() with an intermediate abstract entity class:
as the code iterates over all subclasses (abstract and non-abstract) and expects them in the discriminator map.
Summary
Apparently the intermediate abstract class seems to be expected in the discriminator map, even though the documentation states otherwise.
Not quite sure if the
ClassMetadataInfo::subClassesiteration should directly access the discriminator valuesdiscrValuesinSingleTablePersister::getSelectConditionDiscriminatorValueSQL()as
subClassesis documented with having also abstract classeswhere those are not to be expected in the discriminator map.
Previous behavior
It worked ™️
Current behavior
Access violation on runtime, but not on validation.
How to reproduce
Assume the following example of entities:
plus some boilerplate:
composer.json
bootstrap.php
cli-config.php
and test.php
will result in
while