You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In trying to hydrate collection 'changes' (e.g., an update operation) - I've encountered an issue where adding and removing an element from this collection (via Fieldset) in a single operation causes duplicate key problems as Doctrine flushes.
Is there a means to achieve what I'm after the "Doctrine way", or is clearing and the repopulating the collection the intended behavior? This collection can contain thousands of entities in production, reissuing so many inserts seems wasteful...
I've got a band-aid for now, but was looking for 'the right way' to get this done!
Thank you.
Alex
The text was updated successfully, but these errors were encountered:
If you look at src/Strategy/AllowRemoveByReference, for instance, you should see that a diff between the two collections is build and the individual elements are indeed added or removed. So, technically, the collection is not rebuilt.
The comparison of objects is based on AbstractCollectionStrategy::compareObjects(), which uses spl_object_hash(). Could it be that your objects in fact are not identical, but different instances of the same entity?
Hello!
In trying to hydrate collection 'changes' (e.g., an update operation) - I've encountered an issue where adding and removing an element from this collection (via Fieldset) in a single operation causes duplicate key problems as Doctrine flushes.
I've created a repository to evidence the difficulties being encountered here:
https://github.com/Saeven/CollectionHydration
Is there a means to achieve what I'm after the "Doctrine way", or is clearing and the repopulating the collection the intended behavior? This collection can contain thousands of entities in production, reissuing so many inserts seems wasteful...
I've got a band-aid for now, but was looking for 'the right way' to get this done!
Thank you.
Alex
The text was updated successfully, but these errors were encountered: