PHPackages                             chamber-orchestra/doctrine-extensions-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. chamber-orchestra/doctrine-extensions-bundle

ActiveSymfony-bundle[Database &amp; ORM](/categories/database)

chamber-orchestra/doctrine-extensions-bundle
============================================

Lightweight Symfony Doctrine ORM extensions for PostgreSQL — entity traits, soft-delete filter, repository base classes, decimal type, random() DQL

v8.0.9(2mo ago)0542↑100%2MITPHPPHP ^8.5CI passing

Since Jan 4Pushed 2mo agoCompare

[ Source](https://github.com/chamber-orchestra/doctrine-extensions-bundle)[ Packagist](https://packagist.org/packages/chamber-orchestra/doctrine-extensions-bundle)[ RSS](/packages/chamber-orchestra-doctrine-extensions-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (12)Versions (15)Used By (2)

Chamber Orchestra Doctrine Extensions Bundle
============================================

[](#chamber-orchestra-doctrine-extensions-bundle)

[![PHP Composer](https://github.com/chamber-orchestra/doctrine-extensions-bundle/actions/workflows/php.yml/badge.svg)](https://github.com/chamber-orchestra/doctrine-extensions-bundle/actions/workflows/php.yml)[![codecov](https://camo.githubusercontent.com/34b34051f4a0780c59499166b97dbee27270b4d0087df5deef3cc08c7f27408d/68747470733a2f2f636f6465636f762e696f2f67682f6368616d6265722d6f72636865737472612f646f637472696e652d657874656e73696f6e732d62756e646c652f67726170682f62616467652e737667)](https://codecov.io/gh/chamber-orchestra/doctrine-extensions-bundle)[![PHPStan](https://camo.githubusercontent.com/14995ff65edea59395c224e37e4fc66f91c1e601c1a58311e3c6f38c4fe37feb/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048505374616e2d6c6576656c2532306d61782d627269676874677265656e)](https://phpstan.org/)[![Latest Stable Version](https://camo.githubusercontent.com/1696cf87ba74170b0ccf9266f0e6ede8c30e1ec8f2f1d80a2f846fc5e7442e2b/68747470733a2f2f706f7365722e707567782e6f72672f6368616d6265722d6f72636865737472612f646f637472696e652d657874656e73696f6e732d62756e646c652f76)](https://packagist.org/packages/chamber-orchestra/doctrine-extensions-bundle)[![License](https://camo.githubusercontent.com/d4c4acce3840f7ef1734dda7f63b4a8994c866af6701d1c40f5340bebbce5e1d/68747470733a2f2f706f7365722e707567782e6f72672f6368616d6265722d6f72636865737472612f646f637472696e652d657874656e73696f6e732d62756e646c652f6c6963656e7365)](https://packagist.org/packages/chamber-orchestra/doctrine-extensions-bundle)[![Symfony 8](https://camo.githubusercontent.com/a7d902ab1b809ccff2eaa21df5aadd13f1b13e22e4e4c49f40d020b918f48e05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d382d707572706c653f6c6f676f3d73796d666f6e79)](https://camo.githubusercontent.com/a7d902ab1b809ccff2eaa21df5aadd13f1b13e22e4e4c49f40d020b918f48e05/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53796d666f6e792d382d707572706c653f6c6f676f3d73796d666f6e79)[![Doctrine ORM](https://camo.githubusercontent.com/a2a91493323fa8c68f68f01a24d1f09dc297ca5ac972b7c193ea76d2c8d55325/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f446f637472696e652532304f524d2d332d464336413331)](https://www.doctrine-project.org/)[![PostgreSQL](https://camo.githubusercontent.com/a8ff1aadced317cf743812d01bd7bd2255231b7adced224ab9bb0dbf8e2621d3/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f506f737467726553514c2d6f6e6c792d333336373931)](https://www.postgresql.org/)[![PHP 8.5](https://camo.githubusercontent.com/38189c74fa19d38a84282702897dcd5bf0e54f8ee6be5cb02aa9a3a1f5711862/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)](https://camo.githubusercontent.com/38189c74fa19d38a84282702897dcd5bf0e54f8ee6be5cb02aa9a3a1f5711862/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e352d3737374242343f6c6f676f3d706870266c6f676f436f6c6f723d7768697465)

Lightweight Symfony bundle providing reusable Doctrine ORM extensions for PostgreSQL: entity traits with matching contract interfaces, a soft-delete SQL filter, extended repository base classes, a custom decimal DBAL type, and a `random()` DQL function.

Requirements
------------

[](#requirements)

- PHP ^8.5
- Symfony 8.0
- Doctrine ORM 3 / DoctrineBundle 3.2
- PostgreSQL

Installation
------------

[](#installation)

```
composer require chamber-orchestra/doctrine-extensions-bundle
```

If you are not using Symfony Flex:

```
// config/bundles.php
return [
    ChamberOrchestra\DoctrineExtensionsBundle\ChamberOrchestraDoctrineExtensionsBundle::class => ['all' => true],
];
```

Features
--------

[](#features)

### Entity Traits &amp; Contract Interfaces

[](#entity-traits--contract-interfaces)

Each trait has a corresponding interface in `Contracts\Entity`. Implement the interface and use the trait:

```
use ChamberOrchestra\DoctrineExtensionsBundle\Contracts\Entity\IdInterface;
use ChamberOrchestra\DoctrineExtensionsBundle\Contracts\Entity\SoftDeleteInterface;
use ChamberOrchestra\DoctrineExtensionsBundle\Contracts\Entity\ToggleInterface;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\IdTrait;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\SoftDeleteTrait;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\ToggleTrait;
use ChamberOrchestra\DoctrineExtensionsBundle\Entity\VersionTrait;

class Article implements IdInterface, SoftDeleteInterface, ToggleInterface
{
    use IdTrait;
    use SoftDeleteTrait;
    use ToggleTrait;
    use VersionTrait;
}
```

TraitInterfaceFields &amp; Methods`IdTrait``IdInterface`UUID primary key (caller-assigned). `getId(): Uuid``GeneratedIdTrait``GeneratedIdInterface`UUID primary key (auto-generated, nullable before persist). `getId(): ?Uuid``SoftDeleteTrait``SoftDeleteInterface``deletedDatetime` column. `isDeleted()`, `delete()`, `restore()``ToggleTrait``ToggleInterface``enabled` boolean column. `isEnabled()`, `toggle()`, `enable()`, `disable()``VersionTrait`—Doctrine `@Version` column using `DatePoint` (microsecond precision). `getVersion()`### Soft-Delete Filter

[](#soft-delete-filter)

Automatically appends `deleted_datetime IS NULL` to queries for entities implementing `SoftDeleteInterface`. Bypass per entity when needed:

```
$filter = $entityManager->getFilters()->enable('soft_delete');
$filter->disableForEntity(Article::class);   // include soft-deleted articles
$filter->enableForEntity(Article::class);    // re-enable filtering
```

### Repository Base Classes

[](#repository-base-classes)

Two base classes provide `getOneBy()` and `indexBy()` out of the box:

- `ServiceEntityRepository` — extends Doctrine bundle's `ServiceEntityRepository`, adds `$cacheable` parameter to `createQueryBuilder()`
- `EntityRepository` — extends Doctrine ORM's `EntityRepository`, implements `ServiceEntityRepositoryInterface`

```
use ChamberOrchestra\DoctrineExtensionsBundle\Repository\ServiceEntityRepository;

class ArticleRepository extends ServiceEntityRepository
{
    // getOneBy(criteria, orderBy) — throws EntityNotFoundException if not found
    // indexBy(criteria, orderBy, field) — returns array of field values matching criteria
}
```

### Custom Decimal DBAL Type

[](#custom-decimal-dbal-type)

`DecimalType` overrides Doctrine's `DecimalType` to ensure `convertToPHPValue()` always returns `?string` with scalar type validation.

### DQL Random Function (PostgreSQL)

[](#dql-random-function-postgresql)

Maps `random()` DQL to PostgreSQL `random()`:

```
# config/packages/doctrine.yaml
doctrine:
    orm:
        dql:
            numeric_functions:
                random: ChamberOrchestra\DoctrineExtensionsBundle\Function\Random
```

```
$qb->select('a')->from(Article::class, 'a')->orderBy('random()');
```

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance84

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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

10

Last Release

79d ago

PHP version history (2 changes)v8.0.1PHP ^8.4

v8.0.2PHP ^8.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/44037eb1c8dc2c4fa9871ac213653f33e22a9348dcec7132df07cc71933f2a2e?d=identicon)[wtorsi](/maintainers/wtorsi)

---

Top Contributors

[![wtorsi](https://avatars.githubusercontent.com/u/2115840?v=4)](https://github.com/wtorsi "wtorsi (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

doctrinedoctrine-ormdqlentity-traitsphppostgresqlrepository-patternsoft-deletesymfonysymfony-bundleuuidsymfonydoctrinepostgresqldqluuidrepositorySymfony Bundledoctrine-ormsoft-deletedoctrine-extensionsentity-traits

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/chamber-orchestra-doctrine-extensions-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/chamber-orchestra-doctrine-extensions-bundle/health.svg)](https://phpackages.com/packages/chamber-orchestra-doctrine-extensions-bundle)
```

###  Alternatives

[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.3M152](/packages/sulu-sulu)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[ahmed-bhs/doctrine-doctor

Runtime analysis tool for Doctrine ORM integrated into Symfony Web Profiler. Unlike static linters, it analyzes actual query execution at runtime to detect performance bottlenecks, security vulnerabilities, and best practice violations during development with real execution context and data.

813.1k](/packages/ahmed-bhs-doctrine-doctor)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

50570.7k1](/packages/web-auth-webauthn-framework)[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.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[andanteproject/soft-deletable-bundle

A Symfony Bundle to handle soft deletable with Doctrine Entities

1028.3k](/packages/andanteproject-soft-deletable-bundle)

PHPackages © 2026

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