There is no license information available for the latest version (0.1.1) of this package.

Configure services as Doctrine domain event listeners.

Installs: 141

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 18

Forks: 0


0.1.1 2013-04-27 09:45 UTC

This package is not auto-updated.

Last update: 2020-07-06 09:25:54 UTC


Configure services as Doctrine domain event listeners.

Note: this bundle is not production ready as it requires the master version of DoctrineBundle.


Step 1: Add to composer.json

"require":  {

Step 2: Enable the bundle

Enable the bundle in the kernel:

// app/AppKernel.php

public function registerBundles()
    $bundles = array(
        // ...
        new Astina\Bundle\DomainEventsBundle\AstinaDomainEventsBundle(),


Create subscriber service:

class ProductSupplyWatcher
    public function preUpdate(ProductSupply $supply, PreUpdateEventArgs $event)
        // do stuff

Read more about the (optional) $event parameter in the Doctrine documentation about Entity Listeners.

<service id="product_supply_watcher" class="Astina\Bundle\SandboxBundle\Foo\ProductSupplyWatcher">
    <argument type="service" id="some_service" />

Configure domain event subscriber:

        product_supply_watcher: # this is the service id
            entity: Astina\Bundle\ShopBundle\Model\ProductSupply # entity class
            events: [ preUpdate ] # list of events to listen to

Note that the method name in the subscriber service corresponds with the event name.

Available events:

  • prePersist
  • postPersist
  • preUpdate
  • postUpdate
  • preRemove
  • postRemove
  • preFlush
  • postLoad

##Todo Add possibility to subscribe to changes on specific fields.