-
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
Multiple level discriminator mapping does not work in combination with a self-referencing one-to-many relation. #6488
Comments
What's the code causing that error? Looks like a wrong discriminator value being used? What's the trace for that exception? Can this be reproduced in a test case? |
Hi Ocramius, thanks for your quick reply.
Trace:
|
Is there an automated test for this? |
See https://github.com/doctrine/doctrine2/tree/971c40002522cfebe58d80aff21eef9fe439fa60/tests/Doctrine/Tests/ORM/Functional for examples |
No, there is no automated test for this. For me to make one would take me some time, which I do not have at the moment. So the best I can do for now are the repro steps I provided. Will that be an issue? |
Well, until there's a test case nobody will really look at it :-\ |
After some more investigation it turned out it had nothing to do with the self-referencing relation. Because of this, and some new insights, I have made a new issue: #6558. Will hereby close this one. |
Given the following structure of entities, we are experiencing fatal errors the moment we try to make use of the self-referencing relation.
The multiple level discrimination on itself works fine. We can query for the object directly or get it from a related entity. But the moment we insert data in the parent_id column in the database and try to call the ‘getParent()’ method we get the following fatal error:
PHP Fatal error: Cannot instantiate abstract class FinancialBundle\Entity\Invoice\Line\SocialSupport\AbstractProduct in ..vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php on line 872
An important detail is that we CAN use the self-referencing relation when querying for the ‘AddonMedicine’ entity. So it looks like that when we use the combination of the self-referencing relation AND the multiple level discrimination something is not interpreted right and that Doctrine is trying to instantiate the ‘middle layer’, being the AbstractProduct.
These are the mapping files in use:
AbstractLine
AbstractProduct
OutputOrientedProduct
AddonMedicine
The text was updated successfully, but these errors were encountered: