Get support for KnpLabs/rad-domain-event
If you're new to LTH, please see our FAQ for more information on what it is we do.
Support Options
Unfortunately, there are currently no active helpers for this repository on the platform. Until they become available, we reccomend the following actions:
View Open IssuesTake a look to see if anyone else has experienced the same issue as you and if they managed to solve it.
Open an IssueMake sure to read any relevant guidelines for opening issues on this repo before posting a new issue.
Sponsor directlyCheck out the page and see if there are any options to sponsor this project or it's developers directly.
KnpLabs/rad-domain-event
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.
Knp Rad Domain Event
A lightweight domain event pattern implementation for Doctrine2.
Official maintainers:
Installation
With composer :
$ composer require knplabs/rad-domain-event
If you are using Symfony you can update your app/AppKernel.php
file:
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.
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.
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.
app.event_listener.my_event_listener:
class: App\EventListener\MyEventListener
tags:
- { name: kernel.event_listener, event: myEventName, method: 'onMyEventName' }
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2025 © lth-dev incorporated
p-e622a1a2