Doctrine MongoDB ODM
  1. Doctrine MongoDB ODM
  2. MODM-44

repositoryClass doesn't always get picked up for the Document Annotation

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.0.0BETA1
    • Fix Version/s: None
    • Component/s: Document Manager
    • Labels:
      None
    • Environment:
      SF2
      Config for the Bundle:
      doctrine_odm.mongodb:
        server: mongodb://localhost:27017
        options:
          connect: true

      Description

      Adding the following to getRepository after the $customRepositoryClassName=..

      die(print_r( array($customRepositoryClassName, $metadata),true));
      

      Provides:

      Array ( [0] => [1] => Doctrine\ODM\MongoDB\Mapping\ClassMetadata Object ( [db] => default [collection] => User [identifier] => id [file] => [indexes] => Array ( ) [name] => Bundle\DoctrineUserBundle\Documents\User [namespace] => Bundle\DoctrineUserBundle\Documents [rootDocumentName] => Bundle\DoctrineUserBundle\Documents\User [customRepositoryClassName] => [allowCustomID] => [parentClasses] => Array ( ) [subClasses] => Array ( ) [reflFields] => Array ( [id] => ReflectionProperty Object ( [name] => id [class] => Bundle\DoctrineUserBundle\Documents\User ) ) [_prototype:Doctrine\ODM\MongoDB\Mapping\ClassMetadata:private] => [inheritanceType] => 1 [fieldMappings] => Array ( [id] => Array ( [id] => 1 [fieldName] => id [name] => id [isCascadeRemove] => [isCascadePersist] => [isCascadeRefresh] => [isCascadeMerge] => [isCascadeDetach] => [type] => id [nullable] => ) ) [lifecycleCallbacks] => Array ( ) [discriminatorValue] => [discriminatorMap] => Array ( ) [discriminatorField] => [reflClass] => ReflectionClass Object ( [name] => Bundle\DoctrineUserBundle\Documents\User ) [isMappedSuperclass] => [isEmbeddedDocument] => ) )
      

      For the following Document:

      /**
       * @Document(
       *   db="account",
       *   collection="sf_doctrine_user",
       *   indexes={
       *     @Index(keys={"username"="asc"})
       *   },
       *   repositoryClass="Bundle\UserBundle\Documents\UserRepository"
       * )
       * @HasLifecycleCallbacks
       */
      class User
      

        Activity

        Hide
        D Ashwood added a comment -

        I suspect that it's due to the driver it's using - for some reason it wants to use the XMLDriver.

        Show
        D Ashwood added a comment - I suspect that it's due to the driver it's using - for some reason it wants to use the XMLDriver.
        Hide
        D Ashwood added a comment -

        Ok - I've tracked down this issue and it's related to the XMLDriver being used as the default driver with SF2, MongoBundle & Mongo-odm.

        It'll try to annotation driver correctly if you have a folder called \Document. It would be helpful if we could config the folder name.

        Show
        D Ashwood added a comment - Ok - I've tracked down this issue and it's related to the XMLDriver being used as the default driver with SF2, MongoBundle & Mongo-odm. It'll try to annotation driver correctly if you have a folder called \Document. It would be helpful if we could config the folder name.
        Hide
        Jonathan H. Wage added a comment -

        It works by detecting the files you have in your bundle. Do you have some .dcm.xml files in your bundle?

        Show
        Jonathan H. Wage added a comment - It works by detecting the files you have in your bundle. Do you have some .dcm.xml files in your bundle?
        Hide
        D Ashwood added a comment -

        Nope. They're all PHP files.

        Show
        D Ashwood added a comment - Nope. They're all PHP files.
        Hide
        Jonathan H. Wage added a comment -

        I can't reproduce anything here. It sounds like it would be a Symfony2 issue and not something with the ODM itself.

        Show
        Jonathan H. Wage added a comment - I can't reproduce anything here. It sounds like it would be a Symfony2 issue and not something with the ODM itself.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            D Ashwood
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: