I am trying to integrate zf2 beta3 with doctrine mongo odm (https://github.com/doctrine/DoctrineMongoODMModule) but no sucess.
How can I install and configure it?
I am trying to integrate zf2 beta3 with doctrine mongo odm (https://github.com/doctrine/DoctrineMongoODMModule) but no sucess.
How can I install and configure it?
I will give the steps I have done to integrate zf2 with mongodb doctrine odm
1.Download the mongodb doctrine odm module and place in vendor directory or clone it from github
2.Copy the file from /path/to/project/vendor/DoctrineMongoODMModule/config/module.doctrine_mongodb.config.php.dist, place in your path/to/your/project/config/autoload/ and rename to module.doctrine_mongodb.local.config.php
3.Edit your module.doctrine_mongodb.local.config.php. Change the default db
Change your connection params
Change the driver options
Add proxy and hydratros config
4.Create a directory named "Document" in /path/to/project/module/Application/src/Application/ where goes your documents mapping and inside "Document" directory, create "Proxy" and "Hydrators" directories.
5.Edit your /path/to/project/config/application.config.php and add 'DoctrineMongoODMModule' to modules array
6.Be sure you have mongo php extension installed otherwise download at http://www.php.net/manual/en/mongo.installation.php#mongo.installation.windows and copy it to your extension php directory, usually /php/ext. Add the extension line acording the name file extension you have downloaded "extension=php_mongo-x.x.x-5.x-vc9.dll" in your php.ini.
7.Create a document mapping User.php in your document directory application module.
8.Persist it, for example in your controller
I'm doing just the same thing. Something like this should work:
Download the module, and place in your vendor folder.
Add the module in application.config.php
Copy module.doctrine_mongodb.config.php.dist to /config/autoload
Edit that config file with your own settings
Change the name of that config file to module.doctrine_mongodb.local.config.php
Create a 'setDocumentManager' method in your controller like this:
Place the following in your module's DI config:
Create Document classes according to the Doctrine 2 documentation, and the clarification in this question and answer: Annotations Namespace not loaded DoctrineMongoODMModule for Zend Framework 2
Finally, use the dm like this:
Now the default config has changed, could you show an updated method to get this working in ZF2?
Currently receiving the error: The class 'Application\Document\User' was not found in the chain configured namespaces