[DDC-875] Merge can sometimes add the same entity twice into a collection Created: 11/Nov/10 Updated: 11/Mar/12 Resolved: 11/Mar/12 |
|
| Status: | Closed |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.0-BETA4 |
| Fix Version/s: | None |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Dave Keen | Assignee: | Roman S. Borschel |
| Resolution: | Cannot Reproduce | Votes: | 1 |
| Labels: | None | ||
| Attachments: |
|
| Description |
|
When merging some cascade merge object-graphs, the same entity in a ManyToMany association can be put into a collection twice during doMerge. The attached patch should stop this from happening. |
| Comments |
| Comment by Benjamin Eberlei [ 15/Nov/10 ] |
|
which conditions lead to this problem? I want to write a test for it |
| Comment by Benjamin Eberlei [ 15/Nov/10 ] |
|
not doint the unwrap() but add() directly was a bugfix for one of your other issues .Why is unwrap in here again? |
| Comment by Dave Keen [ 20/Dec/10 ] |
|
Oops - that was a mistake. I have attached multipleaddmerge2.diff which no longer uses unwrap to add the element. |
| Comment by Benjamin Eberlei [ 27/Dec/10 ] |
|
That is exactly the same code in the patch, the lines are just formatted differently. |
| Comment by Dave Keen [ 06/Jan/11 ] |
|
Sorry, I am still getting the hang of git and diff and maybe what I put in there isn't what I meant to. I have now pushed the code to the As far as I can tell I am using unwrap() in order to check whether the element already exists in the array, but then calling |
| Comment by Benjamin Eberlei [ 26/Feb/11 ] |
|
It seems even this issue is caused by multiple calls to persist. I cannot reproduce this with just a single bidirectional cascade merge. |
| Comment by Alexander [ 11/Mar/12 ] |
|
We cannot reproduce this error and haven't had similar complaints ever-since. Feel free to open a new issue with a failing testcase. |