Skip to content
Advertisement

Doctrine unexpected behavior on bidirectional relations

I define two entities with bidirectional relations:

One

JavaScript

And two

JavaScript

If I drop all related Product entities, the related productSet entity automatically dropped too. And I don’t understand why. How I prevent this behavior?

Doctrine version 2.6.3

Advertisement

Answer

according to docs – https://www.doctrine-project.org/projects/doctrine-orm/en/2.7/reference/working-with-associations.html#transitive-persistence-cascade-operations

and you have cascade: ['all'] – the behavior is as expected

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement