Выдает ошибку при удалении агента.
Связь:
/**
* Many Realties have Many Agents.
*
* @ManyToMany(targetEntity="App\Metrag\AppBundle\Entity\Realty", cascade={"persist", "remove"})
* @JoinTable(
* joinColumns={@JoinColumn(name="agent_id", referencedColumnName="id", onDelete="CASCADE")},
* inverseJoinColumns={@JoinColumn(name="realty_id", referencedColumnName="id", onDelete="CASCADE")}
* )
*/
private $realties;
Ошибка:
SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table "agents" violates foreign key co
nstraint "fk_89bf0de13414710b" on table "agent_realties"
DETAIL: Key (id)=(2) is still referenced from table "agent_realties".
In PDOConnection.php line 62:
SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table "agents" violates foreign key co
nstraint "fk_89bf0de13414710b" on table "agent_realties"
DETAIL: Key (id)=(2) is still referenced from table "agent_realties".
In PDOConnection.php line 60:
SQLSTATE[23503]: Foreign key violation: 7 ERROR: update or delete on table "agents" violates foreign key co
nstraint "fk_89bf0de13414710b" on table "agent_realties"
DETAIL: Key (id)=(2) is still referenced from table "agent_realties".