juliangut/doctrine-orm-repositories

Doctrine2 ORM utility entity repositories

0.4 2017-10-30 22:15 UTC

This package is auto-updated.

Last update: 2024-12-15 12:17:59 UTC


README

PHP version Latest Version License

Build Status Style Check Code Quality Code Coverage

Total Downloads Monthly Downloads

doctrine-orm-repositories

Doctrine2 ORM utility entity repositories

Installation

Composer

composer require juliangut/doctrine-orm-repositories

Usage

Use repositoryClass on mapped classes

/**
 * Comment entity.
 *
 * @ORM\Entity(repositoryClass="\Jgut\Doctrine\Repository\ORM\RelationalRepository")
 */
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\ORM\RelationalRepositoryFactory;

$config = new \Doctrine\ORM\Configuration;
$config->setRepositoryFactory(new RelationalRepositoryFactory);

$entityManager = \Doctrine\ORM\EntityManager::create([], $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

Additionally Specification pattern is supported thanks to happyr/doctrine-specification

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.