mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Subclasses of subclasses don't hydrate #5877
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 @technetium on GitHub (Feb 8, 2018).
When I try to get all my entities of a subclass. The subclassed entities of those entities are null.
To reproduce:
Classes definitions:
Expected result:
$this->getEntityManager(Level2:class)->getRepository(Level2:class)->findAll();Should return an array of all Level2 and Level3 objects
Actual result:
Returns an array if all Level2 objects, and null records for all Level3 objects
Solution:
Check in Doctrine/ORM/Internal/Hydration/AbstractHydrator->gatherRowData() not only if the discriminator value in the database is not equal to the value of the discriminator of the class, but also not equal to the values of the subclasses. See my pull request #7051
.
I did not include any test with it. Can someone help me to create tests for this?
@holtkamp commented on GitHub (Feb 8, 2018):
Might be related to https://github.com/doctrine/doctrine2/issues/6937, which got a test case included
@beberlei commented on GitHub (Dec 7, 2020):
Fixed in https://github.com/doctrine/orm/pull/6988