romainneutron / MongoDB-ODM-Silex-Provider

This project is not maintained anymore, contact me to take over it
Other
35 stars 15 forks source link

Document registration - Multiple namespaces #13

Open svscorp opened 10 years ago

svscorp commented 10 years ago

There is a line in documentation:

Document registration
You need to register the differents documents namespace to make possible use it with Doctrine ODM, eg:

$app->register(new MongoDBODMServiceProvider(), array(
    // ...
    'doctrine.odm.mongodb.documents' => array(
        0 => array(
            'type' => 'annotation',
            'path' => array(
                'src/Acme/Entities',
            ),
            'namespace' => 'Acme/Entities',
            'alias'     => 'docs',
        ),
    ),
    // ...
));

you can add multiple folders/namespaces.

But actually if I do:

'namespace' => array('Acme\Entity', 'Acme\Entity\Folder')

I get an error:

PHP Warning:  Illegal offset type in ../vendor/doctrine/common/lib/Doctrine/Common/Persistence/Mapping/Driver/MappingDriverChain.php on line 82
PHP Warning:  trim() expects parameter 1 to be string, array given in ../vendor/doctrine/mongodb-odm/lib/Doctrine/ODM/MongoDB/Configuration.php on line 67
DaMitchell commented 10 years ago

I think it might mean you have to have a separate entry in 'doctrine.odm.mongodb.documents' for each folder/namespace