With Doctrine 2, this is what you need to do:
class Foo { ... private $bar; ... } class Bar { ... }
onDelete = "Cascade" will do what CappY said in its answer (configure your foreign key when deleting the cascade). That way, when you delete your Bar object, the associated Foo object will also be deleted.
If you prefer not to delete your Foo object, you can simply replace onDelete = "Cascade" with onDelete = "SET NULL".
source share