mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-731: Bi-directional cascade #900
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 @doctrinebot on GitHub (Aug 5, 2010).
Jira issue originally created by user jasper:
Example:
In this case, Doctrine should cascade whenever a Bar is deleted. But, when you delete a Foo, it will also cascade the other way around, resulting in also deleting the Bar corresponding to this Foo. A possible solution is unsetting $bar before you remove it in the EntityManager.
@doctrinebot commented on GitHub (Aug 5, 2010):
Comment created by @beberlei:
no, the mapping explicitly says If you delete Foo then also the Bar is deleted, i.e. {cascade="REMOVE"} leads to the behaviour Foo delete -> Bar delete.
@doctrinebot commented on GitHub (Aug 7, 2010):
Comment created by romanb:
You're using application-level and database-level cascades at the same time. This usually does not make sense. The behavior you describe is correct and is caused by the database foreign key constraint which is created with ON DELETE CASCADE.
@doctrinebot commented on GitHub (Aug 7, 2010):
Issue was closed with resolution "Invalid"