2017 © Pedro Peláez
 

symfony-bundle domain-events-bundle

Configure services as Doctrine domain event listeners.

image

astina/domain-events-bundle

Configure services as Doctrine domain event listeners.

  • Wednesday, August 14, 2013
  • by pkraeutli
  • Repository
  • 19 Watchers
  • 1 Stars
  • 138 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Astina Domain Events Bundle

Configure services as Doctrine domain event listeners., (*1)

Note: this bundle is not production ready as it requires the master version of DoctrineBundle., (*2)

Installation

Step 1: Add to composer.json

"require":  {
    "astina/domain-events-bundle":"dev-master",
}

Step 2: Enable the bundle

Enable the bundle in the kernel:, (*3)

<?php
// app/AppKernel.php

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

Usage

Create subscriber service:, (*4)

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., (*5)

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

Configure domain event subscriber:, (*6)

astina_domain_events:
    subscribers:
        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., (*7)

Available events: - prePersist - postPersist - preUpdate - postUpdate - preRemove - postRemove - preFlush - postLoad, (*8)

Todo

Add possibility to subscribe to changes on specific fields., (*9)

The Versions

14/08 2013

dev-master

9999999-dev https://github.com/astina/AstinaDomainEventsBundle

Configure services as Doctrine domain event listeners.

  Sources   Download

MIT

The Requires

 

27/04 2013

0.1.1

0.1.1.0 https://github.com/astina/AstinaDomainEventsBundle

Configure services as Doctrine domain event listeners.

  Sources   Download

The Requires

 

23/04 2013

0.1.0

0.1.0.0 https://github.com/astina/AstinaDomainEventsBundle

Configure services as Doctrine domain event listeners.

  Sources   Download

The Requires