mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #10557] Fix regression with an edge case for the CMF::peekIfIsMappedSuperclass() method
#12455
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?
Original Pull Request: https://github.com/doctrine/orm/pull/10557
State: closed
Merged: No
This comment hints to a case where the
ClassMetadataFactory::peekIfIsMappedSuperclass()method introduced in #10411 causes a failure.CMF::peekIfIsMappedSuperclass()has to perform improvised metadata loading in a situation where the CMF is currently loading a class. So, we cannot use the full/realClassMetadataFactorymechanisms, since it would require a re-entry for a subclass of the current class, causing an infinite loop (loads parent classes first, and that's what we're currently doing).The problem is that the improvised call to
$driver->loadMetadataForClass()cannot provide a pre-filledClassMetadatainstance populated with all parent class fields and associations. But, when attribute or association overrides are used, a check is made to see if the overridden field/association actually exists, and this information is missing in that situation.This PR suggests to override the methods to get around this. In fact, we do not care about all these details, we only want to ask the driver if the class is a mapped superclass or not.
A much better fix would be to have a dedicated method on the driver to ask it just that particular question (also better performance-wise). But I do not see how we could get that done in a BC way – ideas? 💡
A few things that need to come together to make the bug surface: