PHPackages                             curtiskelsey/doctrine-repo-helper - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. curtiskelsey/doctrine-repo-helper

ActiveLibrary[Database &amp; ORM](/categories/database)

curtiskelsey/doctrine-repo-helper
=================================

Generates a trait to help ease the access of custom repo methods

0.5(7y ago)0224[3 issues](https://github.com/curtiskelsey/doctrine-repo-helper/issues)mitPHPPHP ^7.0

Since Jan 12Pushed 7y ago2 watchersCompare

[ Source](https://github.com/curtiskelsey/doctrine-repo-helper)[ Packagist](https://packagist.org/packages/curtiskelsey/doctrine-repo-helper)[ Docs](https://github.com/curtiskelsey/doctrine-repo-helper)[ RSS](/packages/curtiskelsey-doctrine-repo-helper/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (7)Dependencies (11)Versions (10)Used By (0)

Doctrine Repo Helper
====================

[](#doctrine-repo-helper)

[![Build Status](https://camo.githubusercontent.com/f2d85cb7bef95a4fd35a42f759238a746e8e6a0e937c6fd0e9ca63a21f190468/68747470733a2f2f7472617669732d63692e636f6d2f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/curtiskelsey/doctrine-repo-helper)[![Latest Stable Version](https://camo.githubusercontent.com/fe4e578850bf129d0ce800757e138bc971e9b85ccf273aedae4d0467939cdeb6/68747470733a2f2f706f7365722e707567782e6f72672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f762f737461626c65)](https://packagist.org/packages/curtiskelsey/doctrine-repo-helper)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/0b12fdde1eef8e3cb608965205513a6daa49d89415445497bd07a1d5936a981f/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/curtiskelsey/doctrine-repo-helper/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/5cab363f6b9a6dc87ebf5e30956fb0322e58daa3b20909da25d29554601542e1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/curtiskelsey/doctrine-repo-helper/?branch=master)

[![License](https://camo.githubusercontent.com/a55ac4356185c40253746bc944da87bc1a30f6423ac2287aae50bab21f4f3a71/68747470733a2f2f706f7365722e707567782e6f72672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f6c6963656e7365)](https://packagist.org/packages/curtiskelsey/doctrine-repo-helper)[![composer.lock](https://camo.githubusercontent.com/70378b322a7af2082a224b7413f18fa4ae46e574e21fe4892fc3f72b16e91a58/68747470733a2f2f706f7365722e707567782e6f72672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f636f6d706f7365726c6f636b)](https://packagist.org/packages/curtiskelsey/doctrine-repo-helper)[![Total Downloads](https://camo.githubusercontent.com/aa93964a6991e246e6324a1bc887f97e7c10a48015ae273adc52aad9bf6e6645/68747470733a2f2f706f7365722e707567782e6f72672f6375727469736b656c7365792f646f637472696e652d7265706f2d68656c7065722f646f776e6c6f616473)](https://packagist.org/packages/curtiskelsey/doctrine-repo-helper)

This package was created for developers using the `doctrine/doctrine-orm-module`to provide a CLI command for generating custom repository getter methods. Adds:

```
php public/index.php orm:generate-repository-trait

```

to the `doctrine-orm-module cli`.

Introduction
------------

[](#introduction)

Ever worked with Doctrine custom repositories and suffered through

```
/** @var ExampleRepository $exampleRepo */
$exampleRepo = $this->em->getRepository(Example::class);

$exampleRepo->myMethod();

```

just to get autocomplete in your IDE?

With this package you can run

```
php public/index.php orm:generate-repository-trait

```

To create a trait that will simplify working with custom repositories. Just use the trait it creates to get the magic

```
use CustomRepositoryAwareTrait;

public function test()
{
    $result = $this->getExampleRepository()->myMethod();
}

```

Setup
-----

[](#setup)

You can start with

```
composer require curtiskelsey/doctrine-repo-helper

```

then be sure to add

```
'DoctrineRepoHelper'

```

to your Zend application's list of loaded modules.

Options
-------

[](#options)

Several options are provided to allow control over the trait created and what entities it serves:

```
php public/index.php orm:generate-repository-trait --help

Description:
  Generate a repository helper trait

Usage:
  orm:generate-repository-trait [options]

Options:
      --namespace[=NAMESPACE]  Declares the namespace
  -o, --output[=OUTPUT]        Output path [default: "/var/www"]
  -c, --className[=CLASSNAME]  Classname of the trait [default: "CustomRepositoryAwareTrait"]
      --em-getter[=EM-GETTER]  Property or method name to access the EntityManager [default: "getObjectManager()"]
  -f, --force                  Overwrite existing trait
      --filter[=FILTER]        Filter the list of entities getters are created for
  -h, --help                   Display this help message
  -q, --quiet                  Do not output any message
  -V, --version                Display this application version
      --ansi                   Force ANSI output
      --no-ansi                Disable ANSI output
  -n, --no-interaction         Do not ask any interactive question
  -v|vv|vvv, --verbose         Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

Help:
  The generate repository trait command creates a trait that will allow your development
                  environment to autocomplete custom repository methods

```

### Custom output directory

[](#custom-output-directory)

```
php public/index.php orm:generate-repository-trait -o My/Special/Path

```

### Custom trait class name and namespace

[](#custom-trait-class-name-and-namespace)

```
php public/index.php orm:generate-repository-trait -c SpecialName --namespace=Special\\Namespace

```

### Custom entity manager accessor

[](#custom-entity-manager-accessor)

```
php public/index.php orm:generate-repository-trait --em-getter=getMyEntityManager()

```

### Overwrite existing trait file

[](#overwrite-existing-trait-file)

```
php public/index.php orm:generate-repository-trait -f

```

### Filter the entity repositories used within the generated trait

[](#filter-the-entity-repositories-used-within-the-generated-trait)

```
php public/index.php orm:generate-repository-trait --filter=Cast
# Only inserts repo getters for entities where "Cast" is found withing the FQCN string

```

Development
-----------

[](#development)

### Quickstart

[](#quickstart)

- `git clone`
- `vagrant up`
- `vagrant ssh`
- `php public/index.php orm:schema-tool:update -f`
- `php public/index.php orm:generate-repository-trait`

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

7

Last Release

2649d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f66470eadaa7f7e32a8314914d5ab96611571baf4c84fdc9a7016c404dd1d7b3?d=identicon)[curtiskelsey](/maintainers/curtiskelsey)

---

Top Contributors

[![curtiskelsey](https://avatars.githubusercontent.com/u/722417?v=4)](https://github.com/curtiskelsey "curtiskelsey (20 commits)")

---

Tags

clihelperdoctrineextensionrepository

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/curtiskelsey-doctrine-repo-helper/health.svg)

```
[![Health](https://phpackages.com/badges/curtiskelsey-doctrine-repo-helper/health.svg)](https://phpackages.com/packages/curtiskelsey-doctrine-repo-helper)
```

###  Alternatives

[happyr/doctrine-specification

Specification Pattern for your Doctrine repositories

452915.0k8](/packages/happyr-doctrine-specification)[mysql-workbench-schema-exporter/doctrine2-exporter

MySQL Workbench Schema Exporter for Doctrine 2

25143.3k2](/packages/mysql-workbench-schema-exporter-doctrine2-exporter)[mediagone/doctrine-specifications

Doctrine implementation of repository Specifications pattern

353.8k3](/packages/mediagone-doctrine-specifications)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
