[DDC-1925] Bug in UnitOfWork and ManyToMany relations Created: 14/Jul/12 Updated: 29/Jul/12 Resolved: 29/Jul/12 |
|
| Status: | Resolved |
| Project: | Doctrine 2 - ORM |
| Component/s: | ORM |
| Affects Version/s: | 2.1 |
| Fix Version/s: | 2.1.8, 2.3 |
| Security Level: | All |
| Type: | Bug | Priority: | Major |
| Reporter: | Andrew | Assignee: | Marco Pivetta |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
symfony2 |
||
| Description |
|
Lets say, I have entity Forum with ManyToMany relations with User. $uow = $this->getDoctrine() Unfortunately, whenever I try to change manyToMany relations - I got error If I comment uow code - everything works just great. It looks like bug in UnitOfWork implementation. Let me know if you need more details from me. |
| Comments |
| Comment by Marco Pivetta [ 16/Jul/12 ] |
|
What is the part you commented out? Also, in what context is your code executed? |
| Comment by Andrew [ 16/Jul/12 ] |
|
I got error when $em->persist($forum); $em->flush(); executed. I can create github repository with code, which reproduce this error, if you want. |
| Comment by Marco Pivetta [ 16/Jul/12 ] |
|
Please do |
| Comment by Andrew [ 16/Jul/12 ] |
|
that would be simple symfony2 application - will it work for you? |
| Comment by Marco Pivetta [ 16/Jul/12 ] |
|
As long as the code is related to doctrine. Otherwise this issue is quite incomplete |
| Comment by Andrew [ 16/Jul/12 ] |
|
Done, please check https://github.com/zhil/testDoctrine In few words, when I add code like before $em->persist(); $em->flush(); I got fake MYSQL error Thank in advance for your help |
| Comment by Andrew [ 19/Jul/12 ] |
|
Just wonder - is it bug in doctrine2 or its problems somewhere else? (symfony2/my code/ etc.) This is part of the live project - I need to fix it |
| Comment by Marco Pivetta [ 19/Jul/12 ] |
|
I think it is related with the fact that you're using the `UnitOfWork` manually. You can probably try to fix the problem by moving your code to an event subscriber until this is fixed. |
| Comment by Andrew [ 19/Jul/12 ] |
|
Well, I used UnitOfWork, because I need to know what was changed during object validation (for example, property status can be changed only in predefined cases etc.). Ok, thanks for the suggestion - I will implement some temporary solution for this problem |
| Comment by Marco Pivetta [ 19/Jul/12 ] |
|
I think I spotted where this happens, but I don't have a clear overview on the situation. Will try to work on this... |
| Comment by Andrew [ 19/Jul/12 ] |
|
Thanks for the checking this issue. entity { } and validator if(($object->previousStatusBugfix !=
|
| Comment by Marco Pivetta [ 19/Jul/12 ] |
|
I just wrote a couple of tests (attaching them to the issue shortly) and found out that on `>=2.2.x` your code runs perfectly. Now looking if it can be merged into `2.1.x` since it doesn't seem to cause any BC break. |
| Comment by Benjamin Eberlei [ 19/Jul/12 ] |
|
A related Github Pull-Request [GH-402] was opened |
| Comment by Benjamin Eberlei [ 19/Jul/12 ] |
|
A related Github Pull-Request [GH-403] was opened |
| Comment by Marco Pivetta [ 19/Jul/12 ] |
|
Duplicate of |
| Comment by Benjamin Eberlei [ 23/Jul/12 ] |
|
A related Github Pull-Request [GH-403] was closed |
| Comment by Benjamin Eberlei [ 29/Jul/12 ] |
|
A related Github Pull-Request [GH-402] was closed |