Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: Git Master
    • Fix Version/s: 2.5, 2.4.2
    • Component/s: None
    • Security Level: All
    • Labels:
      None

      Description

      I have met a bug with cascade remove that I managed to reproduce with this use case (see also the diagram in the attachments):

      • User has many Roles
      • Roles has many Authorization
      • User has also many Authorization (cache of all authorizations of all roles)

      All these associations are bidirectional, and with "cascade remove".

      When I remove User:

      1. User cascade remove on Role
      2. Role cascade remove on Authorization
      3. User cascade remove on Authorization

      If collections are lazy-loaded, then step 1. will clear the roles from the identityMap, but step 3. will reload the roles (because the authorizations will be lazy-loaded) and re-insert them in the identityMap.

      As a consequence, the first flush() succeeds, but any further flush() yields:

      [Doctrine\ORM\ORMInvalidArgumentException] A new entity was found through the relationship 'Role#user' that was not configured to cascade persist operations for entity...

      I am creating a PR with a testcase, and probably a fix.

        Activity

        Show
        Matthieu Napoli added a comment - PR : https://github.com/doctrine/doctrine2/pull/837
        Hide
        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-837] was closed:
        https://github.com/doctrine/doctrine2/pull/837

        Show
        Doctrine Bot added a comment - A related Github Pull-Request [GH-837] was closed: https://github.com/doctrine/doctrine2/pull/837

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            Matthieu Napoli
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: