Cascading removal oneToMany bidirectional + manyToMany #9016
Unanswered
Nickolaus
asked this question in
Support Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Is it possible to execute a proper casade: remove action in this scenario (sorry for using yml):
EntityA <= should be deleted
When I am trying to remove
EntityAusing the entity manager, the foreign key ona_has_cprevents the removal.Doctrine executes a SQL delete statement of
EntityAafter allbEntitiesare removed but before the manyToMany entries are cascaded.However if I have no
bEntitiesreferencingEntityAallcEntitiesand joinTable Entries are properly removed beforeEntityAis being removed.Why is that the case, I had supposed that this logic would work, but I cannot understand why a deletion of
EntityAis triggered after allbEntitieshave been removed.I would have expected that the complete casacadation would happen before the actual entity to be removed would be deleted.
Can someone explain what doctrine is doing here, and how or if this is problem is solvable via doctrine configuration, or do I always have to remove all oneToMany entries from the owning side (EntityB) via code before actually removing the entity I actually want to remove (EntityA)
Beta Was this translation helpful? Give feedback.
All reactions