Uploaded image for project: 'Doctrine MongoDB ODM'
  1. Doctrine MongoDB ODM
  2. MODM-168

Can't Use Custom Repository Class for Embedded Doc When Using YAML Driver


    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Mapping Drivers
    • Labels:


      When using the Yaml driver the ClassMetadata generation process won't create and use the indicated custom repository class for an embedded document. From what I can see digging into the actual code, it will work when using the Annotations or XML drivers, but in the Yaml driver the call to setCustomRepositoryClass is inside of a conditional that only gets entered if the document type is 'document'.

      I'm not completely sure, but from what I can see elsewhere in the code, it looks like mapped superclasses should also be able to have a custom repository class, but can't when using the Yaml driver.

      So I reckon what would work would be to change the code as indicated below:

      //Doctrine/ODM/MongoDb/Mapping/Driver/YamlDriver.php, line 66
      if ($element['type'] == 'document') {
      if (isset($element['repositoryClass']))

      { $class->setCustomRepositoryClass($element['repositoryClass']); }

      } elseif ($element['type'] === 'mappedSuperclass')

      { $class->isMappedSuperclass = true; }

      elseif ($element['type'] === 'embeddedDocument')

      { $class->isEmbeddedDocument = true; }

      <<TO THIS>>
      if (isset($documentAnnot->repositoryClass))

      { $class->setCustomRepositoryClass($element['repositoryClass']); }


        isac1984 Isaac Foster created issue -

        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=MODM-168}, methodType=GET}] : Received status code 503 (Service Temporarily Unavailable)


          • Assignee:
            jwage Jonathan H. Wage
            isac1984 Isaac Foster
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: