mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Synchronization of bidirectional association cannot be performed in any order #5624
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 @janedbal on GitHub (Jul 31, 2017).
Let's have following entities:
(full example, failing test: #6591)
Calling method moveTo will never update association from Room to new RoomType, because removeElement on PersistentCollection magically changes reference on
Room::$roomTypeback to the old value. To make this work, you first have to remove old association and then create new like this:Is there any reason, why Doctrine behaves like this? From my point of view, this looks like a bug.
@Ocramius commented on GitHub (Jul 31, 2017):
A test is needed to verify this. The code as-is seems sane, and a unit test around the
Roomclass probably shows that the values are correct when not involving Doctrine ORM, but with Doctrine ORM plus your code involved, we need some sort of proof that there is a problem.See https://github.com/doctrine/doctrine2/tree/master/tests/Doctrine/Tests/ORM/Functional/Ticket for examples on such tests.
@janedbal commented on GitHub (Jul 31, 2017):
Ok, I'll send failing test to prove described behaviour.
@janedbal commented on GitHub (Aug 1, 2017):
@Ocramius Failing test added: #6591
@FireLizard commented on GitHub (Oct 29, 2021):
I've got the same issue although
fetch="EXTRA_LAZY"is set on the OneToMany association.Are there any news on this?