PHPackages                             knplabs/rad-doctrine-event - 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. knplabs/rad-doctrine-event

AbandonedArchivedLibrary

knplabs/rad-doctrine-event
==========================

Access your doctrine events from the Symfony DIC.

v2.2.0(8y ago)436.8k↓50%3MITPHPPHP ~7.0

Since Dec 23Pushed 3y ago25 watchersCompare

[ Source](https://github.com/KnpLabs/rad-doctrine-event)[ Packagist](https://packagist.org/packages/knplabs/rad-doctrine-event)[ RSS](/packages/knplabs-rad-doctrine-event/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (7)Versions (9)Used By (0)

DEPRECATED
==========

[](#deprecated)

Unfortunately we decided to not maintain this project anymore ([see why](https://knplabs.com/en/blog/news-for-our-foss-projects-maintenance)). If you want to mark another package as a replacement for this one please send an email to .

Rapid Application Development : Doctrine Events
===============================================

[](#rapid-application-development--doctrine-events)

Access to your doctrine events from the Symfony DIC.

[![Build Status](https://camo.githubusercontent.com/23fad8126236ef708dd95a0f43ee0aecf68b25a925bbd7abef1b2b654ab20f15/68747470733a2f2f7472617669732d63692e6f72672f4b6e704c6162732f7261642d646f637472696e652d6576656e742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/KnpLabs/rad-doctrine-event)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/7245c50f3f71b41bc7d9643a0b99ae6395fc90c7c2357df0a939f7b5c02337de/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f4b6e704c6162732f7261642d646f637472696e652d6576656e742f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/KnpLabs/rad-doctrine-event/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/ac5fe8da89af9695356fdc71df55c0f971c27a4b83653d0b7598eb0df76bfe25/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d646f637472696e652d6576656e742f762f737461626c65)](https://packagist.org/packages/knplabs/rad-doctrine-event) [![Total Downloads](https://camo.githubusercontent.com/57920b178347e9ef6f02f449b22b4da2fc0c378b5980e6dd85d7e1605af29c30/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d646f637472696e652d6576656e742f646f776e6c6f616473)](https://packagist.org/packages/knplabs/rad-doctrine-event) [![Latest Unstable Version](https://camo.githubusercontent.com/5839c00f5021c40de0d458685f018cf2e5c9aba7832d022dac8ae4a7c0125ee1/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d646f637472696e652d6576656e742f762f756e737461626c65)](https://packagist.org/packages/knplabs/rad-doctrine-event) [![License](https://camo.githubusercontent.com/987f1672b7f3c5bb7f8b61b484494bf7192f64f79e71afcb88d0737058f9d325/68747470733a2f2f706f7365722e707567782e6f72672f6b6e706c6162732f7261642d646f637472696e652d6576656e742f6c6963656e7365)](https://packagist.org/packages/knplabs/rad-doctrine-event)

Official maintainers:
=====================

[](#official-maintainers)

- [@Einenlum](https://github.com/Einenlum)

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

[](#installation)

```
composer require knplabs/rad-doctrine-event ~2.1
```

And with Symfony:

```
class AppKernel
{
    function registerBundles()
    {
        $bundles = array(
            //...
            new Knp\Rad\DoctrineEvent\Bundle\DoctrineEventBundle(),
            //...
        );

        //...

        return $bundles;
    }
}
```

Use
===

[](#use)

Context
-------

[](#context)

Let's say you have the following entity:

```
namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class User
{
    //...
}
```

Before
------

[](#before)

In order to plug doctrine events for that entity, we usually do:

```
namespace App\EventListener;

use App\Entity\User;
use Doctrine\ORM\Event\LifecycleEventArgs;

class UserListener
{
    public function prePersist(LifecycleEventArgs $args)
    {
        $entity = $args->getEntity();

        if (false === $entity instanceof User) {
            return;
        }

        // Some stuff
    }
}
```

```
#services.yml
services:
    app.event_listener.user_listener:
        class: App\EventListener\UserListener
        tags:
            - { name: doctrine.event_listener, event: pre_persist, method: prePersist }
```

After
-----

[](#after)

But with the **KnpRadDoctrineEvent** you will need:

```
namespace App\EventListener;

use Knp\Rad\DoctrineEvent\Event\DoctrineEvent;

class UserListener
{
    public function prePersist(DoctrineEvent $event)
    {
        $entity = $event->getEntity();

        // Some stuff
    }
}
```

```
#services.yml
services:
    app.event_listener.user_listener:
        class: App\EventListener\UserListener
        tags:
            - { name: kernel.event_listener, event: app.entity.user.pre_persist, method: prePersist }
```

Inheritance
===========

[](#inheritance)

Context
-------

[](#context-1)

Let's say you have an entity extending another entity:

```
namespace App\Entity;

use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 * @ORM\InheritanceType("JOINED")
 * @ORM\DiscriminatorColumn(name="type", type="string")
 * @ORM\DiscriminatorMap({"page" = "App\Entity\Customer"})
 */
class User
{
    //...
}
```

```
namespace App\Entity;

use App\Entity\User;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;

/**
 * @ORM\Entity
 */
class Customer extends User
{
    //...
}
```

Events
------

[](#events)

The parent entity events are dispatched just before the children entities:

ForFirst eventSecond Eventpre\_persistapp.entity.user.pre\_persistapp.entity.customer.pre\_persistpost\_updateapp.entity.user.pre\_updateapp.entity.customer.pre\_update...Terminate
=========

[](#terminate)

Each `post` (`post_persist`, `post_update`, `post_remove`, `post_load`) event is also redispatched during the `kernel.terminate` event.

EventTerminate eventapp.entity.user.post\_persistapp.entity.user.post\_persist\_terminateapp.entity.user.post\_updateapp.entity.user.post\_update\_terminateapp.entity.user.post\_removeapp.entity.user.post\_remove\_terminateapp.entity.user.post\_loadapp.entity.user.post\_load\_terminateConfiguration
=============

[](#configuration)

You can restrict event re-dispatching to specific entities.

You just have to follow this configuration:

```
knp_rad_doctrine_event:
    entities:
        - MyBundle\Entity\User
```

Then events will be dispatched only for the entity `MyBundle\Entity\User`.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity30

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 52.2% 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 ~167 days

Recently: every ~209 days

Total

7

Last Release

3154d ago

Major Versions

v1.1.0 → v2.0.02015-06-05

PHP version history (2 changes)v1.0.0PHP &gt;=5.4

v2.2.0PHP ~7.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/202732?v=4)[KNP Labs](/maintainers/KnpLabs)[@KnpLabs](https://github.com/KnpLabs)

---

Top Contributors

[![Djeg](https://avatars.githubusercontent.com/u/1638230?v=4)](https://github.com/Djeg "Djeg (12 commits)")[![PedroTroller](https://avatars.githubusercontent.com/u/1766827?v=4)](https://github.com/PedroTroller "PedroTroller (4 commits)")[![polc](https://avatars.githubusercontent.com/u/3513348?v=4)](https://github.com/polc "polc (3 commits)")[![akovalyov](https://avatars.githubusercontent.com/u/2339101?v=4)](https://github.com/akovalyov "akovalyov (2 commits)")[![alexpozzi](https://avatars.githubusercontent.com/u/8307861?v=4)](https://github.com/alexpozzi "alexpozzi (1 commits)")[![umpirsky](https://avatars.githubusercontent.com/u/208957?v=4)](https://github.com/umpirsky "umpirsky (1 commits)")

### Embed Badge

![Health badge](/badges/knplabs-rad-doctrine-event/health.svg)

```
[![Health](https://phpackages.com/badges/knplabs-rad-doctrine-event/health.svg)](https://phpackages.com/packages/knplabs-rad-doctrine-event)
```

###  Alternatives

[sylius/sylius

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

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

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

1.3k1.3M152](/packages/sulu-sulu)[shopware/platform

The Shopware e-commerce core

3.3k1.5M3](/packages/shopware-platform)[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)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)

PHPackages © 2026

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