-
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
Cannot persist parent entity if OneToOne shares the same id #6531
Comments
@davidbarratt this seems to be related to the commit order calculator that was refactored on 2.6 and couldn't be backported, could you please send us a failing test case that reproduces that behaviour (using master)? It would help us a lot to identify and fix the issue you're describing. You can find examples on https://github.com/doctrine/doctrine2/tree/388afb46d0cb3ed0c51332e8df0de9e942c2690b/tests/Doctrine/Tests/ORM/Functional/Ticket |
Was this ever addressed? Do you still need a code sample of a use case? |
Tests are based on examples from "Composite and Foreign Keys as Primary Key" tutorial: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html
Tests are based on examples from "Composite and Foreign Keys as Primary Key" tutorial: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html
Tests are based on examples from "Composite and Foreign Keys as Primary Key" tutorial: http://docs.doctrine-project.org/projects/doctrine-orm/en/latest/tutorials/composite-primary-keys.html
If you have an Entity like this:
and the related entity:
Doing something like this:
will always fail with an error:
I've also tried explicit persisting:
But also fails with the same error.
The only work-around I have found is to remove the related entity completely, then persist & flush and then persist the related entity:
Is there a way to do this without removing the related entities, flushing, and then persisting the related entities afterwards? I think it would be a lot easier if it was possible, if not, is there some way to make it part of the same transaction? (so if the related entity fails persisting, the initial one will be rolled back?)
The text was updated successfully, but these errors were encountered: