Fix UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet #9301
Conversation
cc0549f to
fa3916c
Compare
|
The test is not sufficient, as it does not show that this happens when just using the EntityManager public API. What you are doing might not be a valid use of the internal API of UoW. |
e5c5f77 to
74888e6
Compare
I've rewritten the test to use EntityManager instead of UoW. The issue is with the internal UoW state so the assert does check the UoW directly. I can add additional test case that tests the side effect of not having the persistent collection present in the original data that would throw DUPLICATE INSERT in case the fix is not present if you'd prefer that, let me know :) |
|
I added a second test case showing how dangerous this bug is. Both test cases fail without the fix. |
1c25889 to
b31a306
Compare
b31a306 to
442ba71
Compare
derrabus
left a comment
There was a problem hiding this comment.
Sorry, I wasn't aware of this PR. Can you rebase onto 2.16.x please? We've changed a lot in the UoW recently and I'd like to see if the CI still passes.
442ba71 to
08e410e
Compare
Co-authored-by: Alexander M. Turek <[email protected]>
c800274 to
0752b24
Compare
|
Thank you! It's rebased and review comments are fixed. |
|
Thank you! |
* 2.16.x: Turn identity map collisions from exception to deprecation notice (#10878) Add possibility to set reportFieldsWhereDeclared to true in ORMSetup (#10865) Fix UnitOfWork->originalEntityData is missing not-modified collections after computeChangeSet (#9301) Add an UPGRADE notice about the potential changes in commit order (#10866) Update branch metadata (#10862)
…s after computeChangeSet (doctrine#9301) * Fix original data incomplete after flush * Apply suggestions from code review Co-authored-by: Alexander M. Turek <[email protected]> --------- Co-authored-by: Alexander M. Turek <[email protected]>
|
The change made to UnitOfWork in this fix is breaking ManyToMany associations which are not persisted anymore: Collections are completely cleared on flush. (In my project at least) EDIT: Nevermind this seems to be related to some custom code in my project, still I have a feeling that something is not right if a tiny change like this one can break a major feature. |
Resolves #9300