backplane / doctrine-mongo-odm-module
Forked version of doctrine-mongo-odm-module
Installs: 2 029
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 8
Forks: 74
pkg:composer/backplane/doctrine-mongo-odm-module
Requires
- php: >=5.3.3
- doctrine/doctrine-module: 0.7.*
- doctrine/mongodb-odm: 1.*
- zendframework/zend-mvc: 2.*
- zendframework/zend-servicemanager: 2.*
- zendframework/zend-stdlib: 2.*
This package is not auto-updated.
Last update: 2017-03-10 09:12:28 UTC
README
The DoctrineMongoODMModule integrates Doctrine 2 MongoDB ODM with Zend Framework 2 quickly and easily. The following features are intended to work out of the box:
- MongoDB support
- Multiple document managers
- Multiple connections
- Support for using existing
Mongoconnections - Doctrine Cli support
Requirements
Zend Framework 2 Application Skeleton (or compatible architecture)
Installation
Installation of this module uses composer. For composer documentation, please refer to getcomposer.org.
Installation steps
cd my/project/directorycreate a
composer.jsonfile with following contents:{ "minimum-stability": "alpha", "require": { "doctrine/doctrine-mongo-odm-module": "dev-master" } }- install composer via
curl -s http://getcomposer.org/installer | php(on windows, download http://getcomposer.org/installer and execute it with PHP) - run
php composer.phar install open
my/project/directory/configs/application.config.phpand add following keys to yourmodules(in this order)'DoctrineModule', 'DoctrineMongoODMModule',
copy
vendor/doctrine/doctrine-mongo-odm-module/config/module.doctrine-mongo-odm.local.php.distinto your application'sconfig/autoloaddirectory, rename it tomodule.doctrine-mongo-odm.local.phpand make the appropriate changes. With this config file you can configure your mongo connection, add extra annotations to register, add subscribers to the event manager, add filters to the filter collection, and drivers to the driver chain.create directory
my/project/directory/data/DoctrineMongoODMModule/Proxyandmy/project/directory/data/DoctrineMongoODMModule/Hydratorand make sure your application has write access to it.
Usage
Command Line
Access the Doctrine command line as following
./vendor/bin/doctrine-module
Service Locator
Access the document manager using the following service manager alias:
<?php $dm = $this->getServiceLocator()->get('doctrine.documentmanager.odm_default');
Configuration
Connection section
Either server or connectionString option has to be set.
| Name | Default | Description |
|---|---|---|
| server | 'localhost' | IP of mongod instance |
| port | 27017 | mongod port |
| connectionString | null | If the connection string is specified, it will overwrite other connection options (server,port,user,password,dbname). Still, the connection will respect the settings passed in options array. |
| user | null | If set, the client will try to authenticate with given username and password |
| password | null | If set, the client will try to authenticate with given username and password |
| dbname | null | If dbname is not specified, "admin" will be used for authentication. Also, specifiing dbname affecs the defaultDB configuration option, if that's not specified explicitly. |
| options | array() | Array with connection options. More detailed description in http://www.php.net/manual/en/mongoclient.construct.php |