I have two entites in a ManyToOne relationship:
A *-->1 B
B has a function:
public addA(A $item) {
$this->As[] = $item
}
the problem is that it is possible to add the same instance of A several times to an instane of B, and doing so even one extra time results in a primary key constraint error in the join table.
I know that I could solve this by simply checking if the A instance is already bound to the instance of B before adding it, but is there any way to achieve this same functionality natively in Doctrine? I.e., can I get doctrine to ignore an insertion if it would lead to a duplicate value in a relation?