mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3424: Class Table Inheritance - wrong table order on insert with more than one level of inheritance #4225
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 @doctrinebot on GitHub (Dec 2, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user bmohammed:
when i use class table inheritance with multiple levels in doctrine :
Account<=User<=Dealer
(Dealer inherits from User, User from Account)
Account has the discriminator column and mapping.
when i persist a new Dealer entity I get a foreign key error because there is no row in the User table.
So the order in which the insert statements are executed:
Can someone help me thanks in advance.
@doctrinebot commented on GitHub (Dec 2, 2014):
Comment created by @ocramius:
Is this also valid for
2.4.xandmaster? 2.3.3 is a very old version.Additionally, could you come up with a small reproduction test case? You can check the ones at https://github.com/doctrine/doctrine2/tree/v2.4.6/tests/Doctrine/Tests/ORM/Functional/Ticket for reference
@doctrinebot commented on GitHub (Dec 3, 2014):
Comment created by bmohammed:
This is also valid for 2.4.x and master
this is the test case https://github.com/rogerghost/doctrine2/blob/patch-1/tests/Doctrine/Tests/ORM/Persisters/DDC3424Test.php
@hectoras commented on GitHub (Jan 29, 2016):
Is there a bug/workaround for this? I'm having the same issue: http://stackoverflow.com/questions/35093187/inserts-with-multi-level-entity-inheritance-on-doctrine2
@DHager commented on GitHub (Jan 29, 2016):
Unless it's an issue with the inheritance metadata (which I think it moderately-likely) I believe the "which order to insert in" code lives around
\Doctrine\ORM\UnitOfWork::getCommitOrderand\Doctrine\ORM\Internal\CommitOrderCalculator.@hectoras commented on GitHub (Jan 29, 2016):
I'll try to get more information about how the order is computed on my case, however I don't know much about Doctrine internals. BTW, this is the backtrace of the parent exception Exception thrown, I hope it helps:
\Doctrine\ORM\Version says I'm using '2.5.4'
@hectoras commented on GitHub (Jan 30, 2016):
I've
var_dump()'ed the return value ofUnitOfWork::getCommitOrder()prior to the exception. On theClassMetadatainstances returned, theObjectSetclass seems to appear on theparentClassesproperties correctly; however, there is not an entry for theObjectSetclass itself.The dump (removing most of the info as I think it is not relevant for this case) for the value returned by
UnitOfWork::getCommitOrder():Note there is no entry for
App\Web\Entities\ObjectSet.@mpdude commented on GitHub (Feb 27, 2023):
I cannot imagine this is still an issue. If that would not work, we'd have more bug reports regarding it.
@greg0ire WDYT?
@greg0ire commented on GitHub (Mar 4, 2023):
No comments for 7 years, let's close 👍