mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-2036: indexBy breaks cascade remove #2566
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Sep 20, 2012).
Jira issue originally created by user jebbench:
Adding the annotation indexBy causes the cascade annotation to be ignored:
/****
*
*/
protected $data;
Will cause an error when deleting the objects:
An exception occurred while executing 'DELETE FROM location WHERE id = ?' with params {"1":19306}:
SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (
symfony.location*data, CONSTRAINTFK_2DF7462364D218EFOREIGN KEY (location*id) REFERENCESlocation(id))Removing indexBy fixes the issue.
My class structure is:
Location has many LocationData
LocationData extends AbstractData
The name field I am trying to index by comes from the AbstractData class.