Doctrine 2 - ORM
  1. Doctrine 2 - ORM
  2. DDC-1610

Associations loaded in 'loadClassMetadata' event are not well initialized inside ClassMetadata

    Details

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

      Description

      Reproduce
      ---------------

      • I have an entity
      • I'm loading an association (named 'myfield') inside a `LoadClassMetadata` event.

      Error
      ------

      Then i get this error : Notice: Undefined index: myfield in /vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php line 2473

      Problem
      -----------

      It seems that here https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L294 we call the method 'wakeupReflection' before the loadClassMetadata event is dispatched.

      A solution
      -------------

      I've created a patch (all tests pass) here https://github.com/gordonslondon/doctrine2/commit/0823cd54d0b2720f5e72aa9a29d16271904d99f0 that fixed the issue. Do you want a PR ?

      Here's the PR : https://github.com/doctrine/doctrine2/pull/264

        Activity

        jules b created issue -
        jules b made changes -
        Field Original Value New Value
        Description Reproduce
        ---------------

        - I have an entity
        - I'm loading an association (named 'myfield') inside a `LoadClassMetadata` event.

        Error
        ------

        Then i get this error : Notice: Undefined index: myfield in /vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php line 2473

        Problem
        -----------

        It seems that here https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L294 we call the method 'wakeupReflection' before the loadClassMetadata event is dispatched.


        A solution
        -------------

        I've created a patch (all tests pass) here https://github.com/gordonslondon/doctrine2/commit/0823cd54d0b2720f5e72aa9a29d16271904d99f0 that fixed the issue. Do you want a PR ?




        Many thanks.

        Reproduce
        ---------------

        - I have an entity
        - I'm loading an association (named 'myfield') inside a `LoadClassMetadata` event.

        Error
        ------

        Then i get this error : Notice: Undefined index: myfield in /vendor/doctrine/lib/Doctrine/ORM/UnitOfWork.php line 2473

        Problem
        -----------

        It seems that here https://github.com/doctrine/doctrine2/blob/master/lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php#L294 we call the method 'wakeupReflection' before the loadClassMetadata event is dispatched.


        A solution
        -------------

        I've created a patch (all tests pass) here https://github.com/gordonslondon/doctrine2/commit/0823cd54d0b2720f5e72aa9a29d16271904d99f0 that fixed the issue. Do you want a PR ?

        Here's the PR : https://github.com/doctrine/doctrine2/pull/264

        Benjamin Eberlei made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Fix Version/s 2.2 [ 10157 ]
        Resolution Fixed [ 1 ]
        Benjamin Eberlei made changes -
        Workflow jira [ 13371 ] jira-feedback [ 15203 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback [ 15203 ] jira-feedback2 [ 17067 ]
        Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 17067 ] jira-feedback3 [ 19320 ]

          People

          • Assignee:
            Benjamin Eberlei
            Reporter:
            jules b
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: