-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid Bidirectional Association Mapping with Mapped Superclass in Class Hierarchy #9516
Comments
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? if ($mapping['type'] & ClassMetadata::TO_MANY && ! $mapping['isOwningSide'] && $parentClass->name === $mapping['sourceEntity']) {
throw MappingException::illegalToManyAssociationOnMappedSuperclass($parentClass->name, $field);
} |
Please check if this is already fixed in the current 2.14.x branch |
You might also want to subscribe to #10398 |
…ed superclass in the hierarchy This picks the test case from doctrine#9517 and rebases it onto 2.14.x. The problem has been covered in doctrine#8415, so this PR closes doctrine#9517 and fixes doctrine#9516. Co-authored-by: Robert D'Ercole <bobdercole@gmail.com>
…ed superclass in the hierarchy This picks the test case from doctrine#9517 and rebases it onto 2.14.x. The problem has been covered in doctrine#8415, so this PR closes doctrine#9517 and fixes doctrine#9516. Co-authored-by: Robert D'Ercole <bobdercole@gmail.com>
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. |
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.
orm/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php
Line 381 in e8e61cb
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.
The text was updated successfully, but these errors were encountered: