mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-599: Inheritance breaks cascading #735
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 (May 18, 2010).
Jira issue originally created by user nicokaiser:
When using inheritance, cascade={"delete"} does not work anymore:
This example creates three Entities:
The Item has a OneToMany association with Child with cascade={"delete"}, so if an Item is deleted, its Children are deleted too.
http://pastie.org/965096
However this does not work, the cascade is ignored when the Item is deleted. Without inheritance (e.g. only Item with Children) it works perfectly.
@doctrinebot commented on GitHub (May 18, 2010):
Comment created by nicokaiser:
By the way, this cannot be reproduced with the included testcases (no DB connection). So the problem may be between the ORM and the DBAL...
@doctrinebot commented on GitHub (May 18, 2010):
Comment created by romanb:
Do you get any error message? exception? stack trace?
@doctrinebot commented on GitHub (May 18, 2010):
Comment created by nicokaiser:
PHP Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (
kaiser*sandbox.Child, CONSTRAINTChild_ibfk*1FOREIGN KEY (parentId) REFERENCESItem(id))' in /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php:637Stack trace:
#0 /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php(637): PDOStatement->execute(Array)
#1 /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php(385): Doctrine\DBAL\Connection->executeUpdate('DELETE FROM Ite...', Array)
#2 /home/kaiser/doctrine/doctrine/lib/Doctrine/ORM/Persisters/BasicEntityPersister.php(353): Doctrine\DBAL\Connection->delete('Item', Array)
#3 /home/kaiser/doctrine/doctrine/lib/Doctrine/ORM/UnitOfWork.php(777): Doctrine\ORM\Persisters\BasicEntityPersister->delete(Object(Entities\SubItem))
#4 /home/kaiser/doctrine/doctrine/lib/Doctrine/ORM/UnitOfWork.php(316): Doctrine\ORM\UnitOfWork->_executeDeletions(Object(Doctri in /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php on line 637
@doctrinebot commented on GitHub (May 19, 2010):
Comment created by romanb:
Scheduled for beta2 but not sure we can make it, might end up on beta3. Increasing priority though as this seems to be a bug and these have priority.
@doctrinebot commented on GitHub (Jun 6, 2010):
Comment created by @beberlei:
Attached a test-case that verifies this bug exists.
Problem is the CommitOrderNodeCalculator not knowing about sub-class dependencies.
@doctrinebot commented on GitHub (Jun 7, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/e6884ff3bf41ef83a5a5