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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: