mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[BUG] Incorrect handling of ManyToMany relation with unique constraint #5355
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aivus on GitHub (Dec 21, 2016).
Originally assigned to: @Ocramius on GitHub.
It happens in case of using ManyToMany relation and using unique=true constraint.
collectionUpdateshas updates, where add new relation item before remove old.It causes error:
cd1a5fcadc/lib/Doctrine/ORM/UnitOfWork.php (L388)Workaround: change order of getting entities
See failing tests here:
https://github.com/doctrine/doctrine2/pull/6185
@aivus commented on GitHub (Dec 21, 2016):
It could be fixed by adding different methods
deleteRowandinsertRowinstead ofupdatetoCollectionPersister. But it affects interface and could be done only in the next version.But I'm not sure about efficiency of this.
@Ocramius commented on GitHub (Dec 23, 2016):
Closing as
invalidas per https://github.com/doctrine/doctrine2/pull/6185#issuecomment-268925556