juliangut/doctrine-mongodb-odm-repositories

Doctrine2 MongoDB ODM utility entity repositories

0.5 2018-06-05 22:04 UTC

This package is auto-updated.

Last update: 2021-01-15 03:50:23 UTC


README

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

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.