I'd say this change is long required. I've done is as part of one-to-many-orphan-removal issue I've fixed. You can see the change to UoW here: https://github.com/doctrine/doctrine2/commit/1fa540732f248d51f80384290a66475dc7b9dbdc#diff-6e8c1c1e78b054ba05e20ea09d877865
[]s, On Tue, Jul 21, 2015 at 6:14 PM, Benjamin Morel <[email protected]> wrote: > Hi, when I remove() an item from a Doctrine 2 collection, then add() > another, I noticed that Doctrine performs the INSERT *before *the DELETE, > which causes a unique key constraint to fail on MySQL because the two items > cannot coexist at the same time (MySQL doesn't have deferred constraints at > this time). > > > Is there a way to configure Doctrine so that the DELETE happens before the > INSERT when the collection is synced with the database, without having to > flush() manually between the delete() and add()? > > Also, is there a particular reason for this default behaviour, or is this > a bug in Doctrine 2 that should be reported? > > > Thanks in advance for any insight. > Ben > > -- > You received this message because you are subscribed to the Google Groups > "doctrine-user" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/doctrine-user. > For more options, visit https://groups.google.com/d/optout. > -- Guilherme Blanco MSN: [email protected] GTalk: guilhermeblanco Toronto - ON/Canada -- You received this message because you are subscribed to the Google Groups "doctrine-user" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/doctrine-user. For more options, visit https://groups.google.com/d/optout.
