juliangut / doctrine-mongodb-odm-repositories
Doctrine2 MongoDB ODM utility entity repositories
Requires
- php: ^7.0
- alcaeus/mongo-php-adapter: ^1.0
- doctrine/mongodb-odm: ^1.1
- juliangut/doctrine-base-repositories: ^1.0
Requires (Dev)
- brainmaestro/composer-git-hooks: ^2.1
- friendsofphp/php-cs-fixer: ^2.0
- infection/infection: ^0.7.0
- ocramius/package-versions: ~1.2.0
- phpmd/phpmd: ^2.0
- phpmetrics/phpmetrics: ^2.0
- phpstan/phpstan: ~0.8
- phpunit/phpunit: ^5.7|^6.0
- sebastian/phpcpd: ^2.0
- squizlabs/php_codesniffer: ^2.0
- symfony/console: ^3.0|^4.0
This package is auto-updated.
Last update: 2024-12-15 12:53:26 UTC
README
doctrine-mongodb-odm-repositories
Doctrine2 MongoDB ODM utility entity repositories
Installation
Composer
composer require juliangut/doctrine-mongodb-odm-repositories
Might need "--ignore-platform-reqs" flag
Usage
Use repositoryClass on mapped classes
/** * Comment MongoDB document. * * @ODM\Document(repositoryClass="\Jgut\Doctrine\Repository\MongoDB\ODM\MongoDBRepository") */ class Comment { }
Register factory on managers
When creating object managers you can set a repository factory to create default repositories such as follows
use Jgut\Doctrine\Repository\Factory\MongoDBRepositoryFactory; $config = new \Doctrine\ODM\MongoDB\Configuration; $config->setRepositoryFactory(new MongoDBRepositoryFactory); $documentManager = \Doctrine\ODM\MongoDB\DocumentManager::create(new \Doctrine\MongoDB\Connection(...), $config);
For an easier way of registering repository factories and managers generation in general have a look at juliangut/doctrine-manager-builder
Functionalities
Head to juliangut/doctrine-base-repositories for a full list of new functionalities provided by the repository
Contributing
Found a bug or have a feature request? Please open a new issue. Have a look at existing issues before.
See file CONTRIBUTING.md
License
See file LICENSE included with the source code for a copy of the license terms.