Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-2230

Changes from DDC-1690 trigger a bug in entity merging

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.4
    • Component/s: ORM
    • Security Level: All
    • Labels:
      None

      Description

      Following the changes for DDC-1690, I encountered a serious bug in how EntityManager::merge(...) functions for entities that use NOTIFY change tracking. It's related to interaction between lazy loading and calls to addPropertyChangedListener().

      Scenario:

      • EntityA has a One-To-One, lazy-load association to EntityB
      • EntityB implements NotifyPropertyChanged and uses change tracking policy "NOTIFY"

      Steps to reproduce:

      1. $instanceA = $em->find('EntityA', $id)
      2. $em->clear()
      3. $instanceA = $em->merge($instanceA)
      4. $instanceA->getB() will return a proxy for B that is marked as initialized by contains no data

      Workaround: Mark EntityB::addPropertyChangedListener(...) as 'final', so it doesn't get proxied and lazy loading is not triggered.

        Activity

        Patrick Schwisow created issue -
        Hide
        Patrick Schwisow added a comment -

        Also, the returned proxy from $instanceA->getB() is in the entityStates array but not in the identity map

        Show
        Patrick Schwisow added a comment - Also, the returned proxy from $instanceA->getB() is in the entityStates array but not in the identity map
        Marco Pivetta made changes -
        Field Original Value New Value
        Assignee Benjamin Eberlei [ beberlei ] Marco Pivetta [ ocramius ]
        Hide
        Marco Pivetta added a comment -

        Looks like this one is related to DDC-1734

        Show
        Marco Pivetta added a comment - Looks like this one is related to DDC-1734
        Hide
        Marco Pivetta added a comment -

        I implemented a fix at https://github.com/Ocramius/doctrine2/compare/hotfix;DDC-2230

        Please let me know if that branch works for you: I will open a PR tomorrow.

        Show
        Marco Pivetta added a comment - I implemented a fix at https://github.com/Ocramius/doctrine2/compare/hotfix;DDC-2230 Please let me know if that branch works for you: I will open a PR tomorrow.
        Marco Pivetta made changes -
        Status Open [ 1 ] Awaiting Feedback [ 10000 ]
        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-589] was opened https://github.com/doctrine/doctrine2/pull/589
        Marco Pivetta made changes -
        Status Awaiting Feedback [ 10000 ] In Progress [ 3 ]
        Hide
        Benjamin Eberlei added a comment -

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

        Show
        Benjamin Eberlei added a comment - A related Github Pull-Request [GH-589] was closed https://github.com/doctrine/doctrine2/pull/589
        Marco Pivetta made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Fix Version/s 2.4 [ 10321 ]
        Hide
        Doctrine Bot added a comment -

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

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

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

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

        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-2230, expand=changesets[0:20].revisions[0:29],reviews}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)

          People

          • Assignee:
            Marco Pivetta
            Reporter:
            Patrick Schwisow
          • Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: