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
DDC-1879: Orphans are neither nulled nor removed when merging a graph of detached entities #2542
Comments
Comment created by @Ocramius: I don't think this is valid. Orphan removal scheduling is handled only when an unit of work is available. What's the state of |
@Ocramius I've ran into the same problem today. So I guess this issue is still relevant? I guess
Our expections are:
What I've tried:
But the obsolete children were never deleted from the database. Mapping annotation of
Mapping annotation of
I'm using doctrine/orm in a zend-expressive project with these versions:
|
@MatthiasKuehneEllerhold could you please send us a failing test case that reproduces that behaviour? 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 |
I've opened a PR with a failing test case for this: #6850 . |
I'm running into the same issue. In the PR it is mentioned this might be fixed in version 2.6 but as we're using 2.7.1 I assume this is not the case. Any updates on this issue? I've created a separate repo with a reproducible case here. |
Jira issue originally created by user systho:
When merging a graph of detached entities, the created entitied are created and the updated entities are updated but the non-present entities (which exist in the database but are not in the graph) are neither removed nor have them their association column nullified.
Example :
In my code I have 2 entities : Parent and Child. There is a OneToMany(cascade={"all"}, orphanRemoval=true) relation defined in Parent.
In my database I have a Parent row with an id of 1, which has 3 Children with ids 1,2,3.
When I write the following code, I expect the Parent with id 1 and the Child with id 2 to be updated, a new Child to be created and the Child with id 1 and 3 to be deleted.
The objects I expect to be created and updated have the correct behaviour but the old children are not touched, they are still present in the database.
The text was updated successfully, but these errors were encountered: