PHPackages                             pixelfederation/doctrine-resettable-em-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. pixelfederation/doctrine-resettable-em-bundle

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

pixelfederation/doctrine-resettable-em-bundle
=============================================

Symfony bundle for decorating default entity managers using a resettable decorator.

11.0.0(2mo ago)20113.5k↑15.5%7[3 PRs](https://github.com/pixelfederation/doctrine-resettable-em-bundle/pulls)MITPHPPHP ^8.4CI passing

Since Nov 8Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/pixelfederation/doctrine-resettable-em-bundle)[ Packagist](https://packagist.org/packages/pixelfederation/doctrine-resettable-em-bundle)[ Docs](https://github.com/pixelfederation/doctrine-resettable-em-bundle)[ RSS](/packages/pixelfederation-doctrine-resettable-em-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (48)Versions (45)Used By (0)

Doctrine resettable entity manager bundle
=========================================

[](#doctrine-resettable-entity-manager-bundle)

This bundle should be used with workloads where Symfony doesn't get initialized on each request, but stays in memory and the same instance handles multiple requests, one after another (e.g. when using [Swoole Bundle](https://github.com/pixelfederation/swoole-bundle)). Another use case would be message queue consuming (e.g. Symfony messenger), where it is needed to clear (and possibly reset) the entity manager after processing a message.

The best feature of this bundle is, that it wraps all configured entity managers into a `ResettableEntityManager` instance, which is able to reset the entity manager when it gets stuck on an exception. After each request the entity manager gets cleared or reset, if an exception occurred during request handling.

Also, another feature is that on each request start the entity manager connection gets pinged, so the connection won't get closed after some period of time.

Instalation
-----------

[](#instalation)

`composer require pixelfederation/doctrine-resettable-em-bundle`

SETUP
-----

[](#setup)

```
// config/bundles.php
return [
    //...
    \PixelFederation\DoctrineResettableEmBundle\PixelFederationDoctrineResettableEmBundle::class => ['all' => true]
    //...
];
```

```
pixel_federation_doctrine_resettable_em:
  exclude_from_processing:
    # these entity managers won't be wrapped by the resettable entity manager:
    entity_managers:
        - readonly
    connections:
        # these dbal connections won't be assigned to the keep alive handler
        dbal:
            - readonly
        # these redis cluster connections won't be assigned to the keep alive handler
        redis_cluster:
            - default
  # default 0 - if set, the connection ping operation will be executed each X seconds
  # (instead of at the beginning of each request)
  ping_interval: 10
  # default false - if set to true, the app will check if there is an active transaction
  # in the processed connection, and it will rollback the transaction
  check_active_transactions: true
  # for reader writer connections, each has to be defined as 'reader' or 'writer' to be able for the symfony
  # app to reconnect after db failover. currently only AWS Aurora is supported.
  failover_connections:
    default: writer
  # redis clusters which need to be failed over should be registered here
  # it's really important to set default timeouts to a low value, e.g. 2 seconds, so the app won't block for too long
  redis_cluster_connections:
    default: 'RedisCluster' # connection name (can be literally anything) => redis cluster service id
```

If you have `php-fpm` you need only handle RedisCluster on message queue consuming. So you need to disable Initializers and disable processing for all dbal connections.

```
pixel_federation_doctrine_resettable_em:
  disable_request_initializers: true
  exclude_from_processing:
      connections:
          dbal:
            - default
            - definition
```

To enable ping on entity managers during message queue consuming, you can add `doctrine_ping_connection` middleware:

###  Health Score

63

—

FairBetter than 99% of packages

Maintenance84

Actively maintained with recent releases

Popularity42

Moderate usage in the ecosystem

Community17

Small or concentrated contributor base

Maturity88

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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

Recently: every ~234 days

Total

36

Last Release

82d ago

Major Versions

6.2.0 → 7.0.02023-01-24

7.0.0 → 8.0.02023-08-02

8.1.0 → 9.0.02025-01-17

9.0.0 → 10.0.02025-12-02

10.0.0 → 11.0.02026-02-25

PHP version history (8 changes)1.0.0PHP &gt;=7.2 &lt;7.4

1.3.1PHP &gt;=7.2

2.0.0PHP &gt;=7.4

6.0.1PHP ~7.4 || ~8.0

8.0.0PHP &gt;= 8.1

9.0.0PHP &gt;= 8.2

10.0.0PHP ^8.3

11.0.0PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f41a9b6b3fcc495a546791e3993b29832b7a4b08f34ad094a1131e2e8784d01?d=identicon)[pixelfederation](/maintainers/pixelfederation)

---

Top Contributors

[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (357 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (346 commits)")[![dzoudzou](https://avatars.githubusercontent.com/u/2709249?v=4)](https://github.com/dzoudzou "dzoudzou (5 commits)")[![surikman](https://avatars.githubusercontent.com/u/7412310?v=4)](https://github.com/surikman "surikman (5 commits)")[![pmysiak](https://avatars.githubusercontent.com/u/1159674?v=4)](https://github.com/pmysiak "pmysiak (2 commits)")[![majoskorec](https://avatars.githubusercontent.com/u/10130278?v=4)](https://github.com/majoskorec "majoskorec (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pixelfederation-doctrine-resettable-em-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/pixelfederation-doctrine-resettable-em-bundle/health.svg)](https://phpackages.com/packages/pixelfederation-doctrine-resettable-em-bundle)
```

###  Alternatives

[sylius/sylius

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

8.4k5.6M651](/packages/sylius-sylius)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.0k15.4k](/packages/prestashop-prestashop)[sulu/sulu

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

1.3k1.3M152](/packages/sulu-sulu)[ec-cube/ec-cube

EC-CUBE EC open platform.

78527.0k1](/packages/ec-cube-ec-cube)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)

PHPackages © 2026

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