PHPackages                             tbn/query-builder-repository-generator-bundle - 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. tbn/query-builder-repository-generator-bundle

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

tbn/query-builder-repository-generator-bundle
=============================================

Generate filters for queryBuilder in a repository

2.2.0(10mo ago)39.9k↓64.8%2PHPPHP ^8.1CI failing

Since Mar 19Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/thomasbeaujean/QueryBuilderRepositoryGeneratorBundle)[ Packagist](https://packagist.org/packages/tbn/query-builder-repository-generator-bundle)[ RSS](/packages/tbn-query-builder-repository-generator-bundle/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (10)Dependencies (8)Versions (14)Used By (0)

QueryBuilderRepositoryGeneratorBundle
=====================================

[](#querybuilderrepositorygeneratorbundle)

The QueryBuilderRepositoryGeneratorBundle generates Repositories in the repository folders

The functions allow to filter on the columns of the entity with a query builder.

See the create queries section for an example.

Installation
============

[](#installation)

Import the bundle using composer
--------------------------------

[](#import-the-bundle-using-composer)

```
composer require --dev "tbn/query-builder-repository-generator-bundle"

```

Import the bundle in your AppKernel
-----------------------------------

[](#import-the-bundle-in-your-appkernel)

```
if ('dev' === $this->getEnvironment()) {
    $bundles[] = new Tbn\QueryBuilderRepositoryGeneratorBundle\QueryBuilderRepositoryGeneratorBundle();
}

```

Configuration
=============

[](#configuration)

Mandatory configuration
-----------------------

[](#mandatory-configuration)

Add the bundles you want:

```
	query_builder_repository_generator:
		bundles:
    		- ""

```

Those bundles will have the repositories generated in the Repository directory of the bundles. Check the content by yourself.

Optional configuration
----------------------

[](#optional-configuration)

```
	query_builder_repository_generator:
		templates:
			top_repository: "QueryBuilderRepositoryGeneratorBundle:Generator:TopRepositoryTemplate.html.twig"
			column: "QueryBuilderRepositoryGeneratorBundle:Generator:ColumnTemplate.html.twig"
			association: "QueryBuilderRepositoryGeneratorBundle:Generator:AssociationTemplate.html.twig"
			bottom_repository: "QueryBuilderRepositoryGeneratorBundle:Generator:BottomRepositoryTemplate.html.twig"
	mapping:
		- 'AppBundle\Entity\Member':
			querybuilder_name: 'memberEntity' # the name of the entity used in the queryBuilder

```

### The repository extends

[](#the-repository-extends)

You can specify a class to extends for each entity.

```
	repositories_extensions:
		- "AcmeBundle\Entity\Item": #the entity class
			extension_class: "\\Gedmo\\Tree\\Entity\\Repository\\MaterializedPathRepository" #the class to extends

```

The templates used by the generator can be set with these configurations.

```
	top_repository => The beginning of the repository file
	column => The template used for each column
	extra_column => A custom template of your choice
	bottom_repository => The end of the repository file

```

The extra\_column template have the following variables:

```
	'entity' => $tableName,
	'entityDql' => lcfirst($tableName),
	'column' => ucfirst($columnName),
	'columnDql' => $columnName

```

Use generated repositories
==========================

[](#use-generated-repositories)

In your Entity Repository, extends the generated repository.

```
	class UserRepository extends UserRepositoryBase

```

Your repository has now some predefined function like "filterById", "filterInId" for all the columns.

Create queries
==============

[](#create-queries)

Example:

```
	$qb = $this->createQueryBuilder('document');

	//filter on current user (where XX = YY)
   DocumentRepository::filterByUser($qb, $user);
   //filter on the extension list (where xxx IN () )
   DocumentRepository::filterInExtension($qb, $extensionList);

   //Join the tag entity
   $qb->join('document.tags', 'tag');
   //filter on the tag entity
   TagRepository::filterById($qb, $tagButton);

```

Regenerate files
================

[](#regenerate-files)

Run the command:

```
php app/console qbrg:generate

```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance64

Regular maintenance activity

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity79

Established project with proven stability

 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 ~423 days

Recently: every ~765 days

Total

10

Last Release

316d ago

Major Versions

1.1.0 → 2.0.02024-03-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ea8a2617988a793aef214fa41de59c562bd141343046102e6bf87d6db4cc354?d=identicon)[thomasbeaujean](/maintainers/thomasbeaujean)

---

Top Contributors

[![thomasbeaujean](https://avatars.githubusercontent.com/u/5817919?v=4)](https://github.com/thomasbeaujean "thomasbeaujean (68 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/tbn-query-builder-repository-generator-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/tbn-query-builder-repository-generator-bundle/health.svg)](https://phpackages.com/packages/tbn-query-builder-repository-generator-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1189.8k](/packages/rcsofttech-audit-trail-bundle)[kimai/kimai

Kimai - Time Tracking

4.8k9.0k1](/packages/kimai-kimai)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1616.4k14](/packages/2lenet-crudit-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M738](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)

PHPackages © 2026

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