Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0-BETA2
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      When using inheritance, cascade=

      {"delete"} does not work anymore:

      This example creates three Entities:
      - Item
      - SubItem (extends Item)
      - Child

      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.

        Activity

        Hide
        nicokaiser Nico Kaiser added a comment -

        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...

        Show
        nicokaiser Nico Kaiser added a comment - 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...
        Hide
        romanb Roman S. Borschel added a comment - - edited

        Do you get any error message? exception? stack trace?

        Show
        romanb Roman S. Borschel added a comment - - edited Do you get any error message? exception? stack trace?
        Hide
        nicokaiser Nico Kaiser added a comment -

        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`, CONSTRAINT `Child_ibfk_1` FOREIGN KEY (`parentId`) REFERENCES `Item` (`id`))' in /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php:637
        Stack 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

        Show
        nicokaiser Nico Kaiser added a comment - 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`, CONSTRAINT `Child_ibfk_1` FOREIGN KEY (`parentId`) REFERENCES `Item` (`id`))' in /home/kaiser/doctrine/doctrine/lib/Doctrine/DBAL/Connection.php:637 Stack 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
        Hide
        romanb Roman S. Borschel added a comment -

        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.

        Show
        romanb Roman S. Borschel added a comment - 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.
        Hide
        beberlei Benjamin Eberlei added a comment -

        Attached a test-case that verifies this bug exists.

        Problem is the CommitOrderNodeCalculator not knowing about sub-class dependencies.

        Show
        beberlei Benjamin Eberlei added a comment - Attached a test-case that verifies this bug exists. Problem is the CommitOrderNodeCalculator not knowing about sub-class dependencies.

          People

          • Assignee:
            romanb Roman S. Borschel
            Reporter:
            nicokaiser Nico Kaiser
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: