2017 © Pedro Peláez
 

library rad-domain-event

Provide RAD Domain Event component

image

knplabs/rad-domain-event

Provide RAD Domain Event component

  • Thursday, September 21, 2017
  • by Knplabs
  • Repository
  • 20 Watchers
  • 5 Stars
  • 15,730 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 3 Open issues
  • 7 Versions
  • 4 % Grown

The README.md

DEPRECATED

Unfortunately we decided to not maintain this project anymore (see why). If you want to mark another package as a replacement for this one please send an email to hello@knplabs.com., (*1)

Knp Rad Domain Event

Build Status Scrutinizer Code Quality Latest Stable Version Total Downloads Latest Unstable Version License, (*2)

A lightweight domain event pattern implementation for Doctrine2., (*3)

Official maintainers:

Installation

With composer :, (*4)

$ composer require knplabs/rad-domain-event

If you are using Symfony you can update your app/AppKernel.php file:, (*5)

public function registerBundles()
{
    $bundles = array(
        // bundles here ...
        new Knp\Rad\DomainEvent\Bundle\DomainEventBundle();
    );
}

Usage

Setup your entity

First, make sure your entity implements the Provider interface and uses the ProviderTrait., (*6)

use Knp\Rad\DomainEvent;

class MyEntity implements DomainEvent\Provider
{
    use DomainEvent\ProviderTrait;
}

Raise event

Trigger any event from your entity, through the raise method. It will be turned into a Knp\Rad\DomainEvent\Event object and dispatched once your entity has been flushed., (*7)

use Knp\Rad\DomainEvent;

class MyEntity implements DomainEvent\Provider
{
    // ...
    public function myFunction($arg) {
        // your function behavior
        $this->raise('myEventName', ['anyKey' => $anyValue]);
    }
}

Listen to this event

use Knp\Rad\DomainEvent\Event;

class MyListener
{
    public function onMyEventName(Event $event) {
        // your function behavior     
    }
}

Then, of course, register your listener., (*8)

app.event_listener.my_event_listener:
    class: App\EventListener\MyEventListener
    tags:
        - { name: kernel.event_listener, event: myEventName, method: 'onMyEventName' }

The Versions

21/09 2017

dev-master

9999999-dev

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

21/09 2017

v2.1.0

2.1.0.0

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

18/09 2017

2.0.1

2.0.1.0

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

04/03 2016

v2.0.0

2.0.0.0

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

30/11 2015

1.0.x-dev

1.0.9999999.9999999-dev

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

30/11 2015

1.0.0

1.0.0.0

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs

24/06 2015

0.1.0

0.1.0.0

Provide RAD Domain Event component

  Sources   Download

MIT

The Requires

 

The Development Requires

by KNP Labs