Skip to content

About

A different method of creating entity repositories for use with Doctrine.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Latest commit

 

History

5 Commits

Folders and files

Repository files navigation

XM\Doctrine Entity Repository

A different way of creating Doctrine Repositories based on this article by Magnus Nordlander. The main difference (as opposed to "normal" Doctrine Repositories) is that these can be autowired by Symfony. We've also found them easier to test.

Repositories extending this class should not be referenced by the repositoryClass entity mapping. But the repository can be used in the same way as "normal" Doctrine Entity Repositories.

Installation

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

composer require xm/doctrine-entity-repository

This command requires Composer.

Usage

<?php

namespace AppBundle\Repository;

use AppBundle\Entity\User;
use XM\EntityRepository;

class UserRepository extends EntityRepository
{
    /**
     * The entity class name that the repository is for.
     * Required. 
     */
    protected $class = User::class;
    
    // ... custom methods
}

About

A different method of creating entity repositories for use with Doctrine.

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages