crawly / doctrine-mongodb-odm
There is no license information available for the latest version (2.0.1) of this package.
A simple component that provides Doctrine ODM factories for PSR-11
2.0.1
2019-10-09 13:02 UTC
Requires
- php: ^7.2
- doctrine/mongodb-odm: ^2.0.1
- psr/container: ^1.0
Requires (Dev)
- phpunit/phpunit: ^8.2
This package is not auto-updated.
Last update: 2020-10-09 16:56:48 UTC
README
A simple component that provides Doctrine ODM factories for PSR-11.
This package provides a set of factories to be used with containers using the PSR-11 standard for an easy Doctrine integration in a project.
Support for Zend Expressive, SlimPHP, Lumen and any other micro-framework that implement PSR-11.
Requirements
- PHP 7.2+
- ext-mongodb 1.5 or newer
Installation
Install this library using composer:
$ composer require crawly/doctrine-mongodb-odm
Configuration
Config file example.
return [ 'config' => [ ... 'doctrine' => [ 'default' => 'odm_default', 'connection' => [ 'odm_default' => [ 'server' => 'localhost', 'port' => '27017', 'user' => 'myUser', 'password' => 'password', 'dbname' => 'dbName', 'options' => [] ], 'odm_secondary' => [ 'connectionString' => 'mongodb://username:password@server2:27017/mydb', 'options' => [] ], ], 'driver' => [ 'odm_default' => [ \Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver::class => [ 'documents_dir' => ['./src/myApp/Documents'] ], \Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver::class => [ 'simplified' => false, 'xml_dir' => [ '/path/to/files1', '/path/to/files2', ] ], \Doctrine\ODM\MongoDB\Mapping\Driver\MappingDriverChain::class => [ 'Driver\Annotation' => \Doctrine\ODM\MongoDB\Mapping\Driver\AnnotationDriver::class, 'Driver\Xml' => \Doctrine\ODM\MongoDB\Mapping\Driver\XmlDriver::class, ], ], ], 'configuration' => [ 'odm_default' => [ 'metadata_cache' => \Doctrine\Common\Cache\ArrayCache::class, // optional 'driver' => \Doctrine\ODM\MongoDB\Mapping\Driver\MappingDriverChain::class, 'generate_proxies' => \Doctrine\ODM\MongoDB\Configuration::AUTOGENERATE_FILE_NOT_EXISTS, 'proxy_dir' => 'data/DoctrineMongoODMModule/Proxy', 'proxy_namespace' => 'DoctrineMongoODMModule\Proxy', 'generate_hydrators' => \Doctrine\ODM\MongoDB\Configuration::AUTOGENERATE_FILE_NOT_EXISTS, 'hydrator_dir' => 'data/DoctrineMongoODMModule/Hydrator', 'hydrator_namespace' => 'DoctrineMongoODMModule\Hydrator', 'default_db' => 'MyDBName', 'filters' => [], // custom filters (optional) 'types' => [], // custom types (optional) 'retry_connect' => 0 // optional 'retry_query' => 0 // optional 'logger' => \MyLogger::calss \\ Logger implementation (optional) 'classMetadataFactoryName' => 'stdClass' \\ optional ] ], 'documentmanager' => [ 'odm_default' => [ 'connection' => \Doctrine\ODM\MongoDB\Connection::class, 'configuration' => \Doctrine\ODM\MongoDB\Configuration::class, 'eventmanager' => \Doctrine\ODM\MongoDB\EventManager::class, \\ optional ], 'odm_secondary' => [ 'connection' => 'doctrine.connection.secondary', 'configuration' => \Doctrine\ODM\MongoDB\Configuration::class, 'eventmanager' => 'doctrine.eventmanager.secondary', \\ optional ] ], ], ... ], ];
Support for older Doctrine ODM, PHP and MongoDB versions is provided via the 1.0.x releases.