mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
Somehow UnitOfWork delete first parent entity but not children with cascade remove, thus throwing ForeignKeyConstraintViolationException #5264
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 @idchlife on GitHub (Sep 20, 2016).
This is the place where UnitOfWork continues (in loop) with child entity with relation OneToMany and deletes parent before child.
I have this in User entity:
and this in Gallery entity:
Apparently, Gallery does not have className as User and it's deletion is not executed before user.
But, in UnitOfWork::$entityDeletions gallery comes first and user second. Because of foreign key gallery should be deleted first, then user.
Is this a bug or have I done something wrong?
More info on entityDeletions property:
and part where it checking whether className is equal with entity className