Uploaded image for project: 'Doctrine 2 - ORM'
  1. Doctrine 2 - ORM
  2. DDC-1441

Metadata cannot be loaded for not registered proxy objects


    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.1.2
    • Fix Version/s: None
    • Component/s: ORM
    • Security Level: All
    • Labels:
    • Environment:
      MySQL, Ubuntu, PHP 5.3.6


      We are using several Doctrine managers in our project with the same entity classes and different database tables.

      The problem appears when we are willing to merge entity with lazy associations from one manager to another. The second entity manager instance hasn't got the proxy object metadata defined yet so it fails with Doctrine\ORM\Mapping\MappingException exception "Class EntityProxy is not a valid entity or mapped super class.".

      If both entity managers share the proxy objects the problem can be fixed by calling

      $em->getProxyFactory()->getProxy('Entity', -1);

      which will register the entity metadata for the proxy classname as well.

      Still if the proxy configuration differs, there is no fix found without changing the Doctrine ORM code.

      The fix inside the Doctrine would be to detect Proxy classes before loading the metadata and load the metadata for it's parent class instead. Please see the diff attached with proposed solution.

      Also I think this issue could arise when unserialized entity objects will be merged into the entity manager. I will try creating test case for this.

      1. DDC1441Test.php
        2 kB
        Aigars Gedroics
      2. not-loaded-proxy-patch.diff
        1 kB
        Aigars Gedroics


        gedrox Aigars Gedroics created issue -
        gedrox Aigars Gedroics added a comment -

        Test case attached.

        gedrox Aigars Gedroics added a comment - Test case attached.
        gedrox Aigars Gedroics made changes -
        Field Original Value New Value
        Attachment DDC1441Test.php [ 11116 ]
        gedrox Aigars Gedroics added a comment -
        gedrox Aigars Gedroics added a comment - See my pull request in https://github.com/doctrine/doctrine2/pull/332 .
        beberlei Benjamin Eberlei made changes -
        Workflow jira [ 13106 ] jira-feedback [ 13979 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback [ 13979 ] jira-feedback2 [ 15843 ]
        beberlei Benjamin Eberlei made changes -
        Workflow jira-feedback2 [ 15843 ] jira-feedback3 [ 18099 ]

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


          • Assignee:
            beberlei Benjamin Eberlei
            gedrox Aigars Gedroics
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: