11
I have two entities with a one-to-one unidirectional relationship:
class Foo {
...
/**
* @OneToOne(targetEntity="Bar")
*/
private $bar;
...
}
class Bar {
...
}
When I try to delete a Bar entity I get this error:
Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails
How do I keep a unidirectional relationship without loosing the ability to delete Bar entities?