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
-
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
EntityA
using the entity manager, the foreign key ona_has_c
prevents the removal.Doctrine executes a SQL delete statement of
EntityA
after allbEntities
are removed but before the manyToMany entries are cascaded.However if I have no
bEntities
referencingEntityA
allcEntities
and joinTable Entries are properly removed beforeEntityA
is being removed.Why is that the case, I had supposed that this logic would work, but I cannot understand why a deletion of
EntityA
is triggered after allbEntities
have 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