There are two kinds of cascades in Doctrine:
-
ORM level – uses
cascade={"remove"}in the association – this is a calculation that is done in theUnitOfWorkand does not affect the database structure. When you remove an object, theUnitOfWorkwill iterate over all objects in the association and remove them. -
Database level – uses
onDelete="CASCADE"on the association’s joinColumn – this will add On Delete Cascade to the foreign key column in the database:@ORM\JoinColumn(name="father_id", referencedColumnName="id", onDelete="CASCADE")
I also want to point out that the way you have your cascade={"remove"} right now, if you delete a Child object, this cascade will remove the Parent object. Clearly not what you want.