mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Invalid Bidirectional Association Mapping with Mapped Superclass in Class Hierarchy #6933
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 @bobdercole on GitHub (Feb 15, 2022).
Bug Report
Summary
I receive a mapping exception after defining an inverse-side association on an abstract entity. A mapped superclass extends the abstract entity. A concrete entity extends the mapped superclass.
Current behavior
ClassMetadataFactory is currently throwing an exception if there is an inverse-side association on a mapped superclass.
e8e61cbbd5/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php (L381)This is correct, as stated in the documentation. However, I believe this limitation should be imposed only if the association is on the mapped superclass itself.
How to reproduce
I will follow-up with a failing test case.
Expected behavior
I think the above mapping should be valid since the association is not defined directly on the mapped superclass.
@bobdercole commented on GitHub (Feb 15, 2022):
Here is my failing test case: #9517.
My proposed fix is to add a condition to ClassMetadataFactory to only throw the exception if the association is directly on the mapped superclass. Maybe something like this?
@mpdude commented on GitHub (Feb 21, 2022):
Related to #8415 (as per #9517).
@mpdude commented on GitHub (Jan 23, 2023):
Please check if this is already fixed in the current 2.14.x branch
@mpdude commented on GitHub (Jan 23, 2023):
You might also want to subscribe to #10398
@bobdercole commented on GitHub (Jan 28, 2023):
Yes! It works now. Thank you for all the work you've done to resolve it!
I suppose we should keep this open until the regression test PR is merged.
@mpdude commented on GitHub (Jan 28, 2023):
@greg0ire maybe a low hanging fruit:
Merge #10453 and then close the issues and PRs linked from it