mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Commit order issue #4924
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 @kilhage on GitHub (Dec 8, 2015).
I have a very annoying issue regarding the commit order calculated by the UnitOfWork & CommitOrderCalculator components.
I have two entities, the important parts in this case looks like this:
The code snippet I have problem when looks like this:
Then the following exception will be thrown:
When looking at the sql statements executed I see these in the logs:
If I instead run the following snippet:
The error occurs becouse depending on what entity gets persisted first, the \Doctrine\ORM\UnitOfWork::getCommitOrder will build commit order differently because the two entities are dependent of each other, but since the thumbnail_id is nullable this should still work..
One solution to this would of course be a different approach to the thumbnails but I'd stil expect the above test cases not to throw errors and the commit order to be consistent.
Please suggest a way around this without adding extra flushes, or change the order I persist the objects. I have a number of use cases in the project where this is used where I need to persist the objects in the order as in the test cases and can't add flushes because of performance reasons.
Any help is appreciated, thanks.
@guilhermeblanco commented on GitHub (Dec 8, 2015):
Which version are you using? I have fixed this problem on master (aka. 2.6.0-dev)
@kilhage commented on GitHub (Dec 8, 2015):
I'm using 2.5.2, any plans of cherry picking this fix into 2.5.3 or do we have to wait until 2.6? When is this scheduled to be release?
I can verify that this problem is fixed in master!
@Ocramius commented on GitHub (Dec 9, 2015):
In order to release 2.6, we still need to correct doctrine/data-fixtures#212 :-(
@mpdude commented on GitHub (Feb 20, 2023):
@kilhage it sounds as if this has been resolved, can you confirm that?
@mpdude commented on GitHub (Feb 27, 2023):
Your description is incomplete, for example it does not deal with the
thumbnail