Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Critical 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

        Nico Kaiser created issue -
        Hide
        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
        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...
        Nico Kaiser made changes -
        Field Original Value New Value
        Summary Inheritance breaks onCascade Inheritance breaks cascading
        Description When using inheritance, onCascade={"delete"} does not work anymore:

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

        The Item has a OneToMany association with Child with onCascade={"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.
        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.
        Hide
        Roman S. Borschel added a comment - - edited

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

        Show
        Roman S. Borschel added a comment - - edited Do you get any error message? exception? stack trace?
        Hide
        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
        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
        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
        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.
        Roman S. Borschel made changes -
        Fix Version/s 2.0-BETA2 [ 10050 ]
        Priority Major [ 3 ] Critical [ 2 ]
        Roman S. Borschel made changes -
        Assignee Roman S. Borschel [ romanb ] Benjamin Eberlei [ beberlei ]
        Hide
        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
        Benjamin Eberlei added a comment - Attached a test-case that verifies this bug exists. Problem is the CommitOrderNodeCalculator not knowing about sub-class dependencies.
        Benjamin Eberlei made changes -
        Attachment DDC599Test.php [ 10628 ]
        Roman S. Borschel made changes -
        Assignee Benjamin Eberlei [ beberlei ] Roman S. Borschel [ romanb ]
        Roman S. Borschel made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Roman S. Borschel made changes -
        Status In Progress [ 3 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 11380 ] jira-feedback [ 15632 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15632 ] jira-feedback2 [ 17496 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17496 ] jira-feedback3 [ 19753 ]

        This list may be incomplete, as errors occurred whilst retrieving source from linked applications:

        • Request to http://www.doctrine-project.org/fisheye/ failed: Error in remote call to 'FishEye 0 (http://www.doctrine-project.org/fisheye/)' (http://www.doctrine-project.org/fisheye) [AbstractRestCommand{path='/rest-service-fe/search-v1/crossRepositoryQuery', params={query=DDC-599, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

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

            Dates

            • Created:
              Updated:
              Resolved: