mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
[PR #10548] Failing test: UoW unable to break cycles when removing entities without DB-level cascade #12450
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?
Original Pull Request: https://github.com/doctrine/orm/pull/10548
State: closed
Merged: No
This adds a failing test case for #5665.
In this example, we have a cyclic association between three entities. All associations are NULLable, so the ORM is able to perform the INSERT operation: The cycle can be broken by scheduling an "extra UPDATE" in the UoW.
However, the UoW is unable to perform the remove operation. Cyclic references by the foreign keys in the database prevent removal of two of the entities.
If the ORM were able to detect this case and perform an UPDATE before the DELETE, the test would pass – this is what the OP of #5665 asks for.
A workaround might be to use
@JoinColumn(onDelete="SET NULL")].