<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ashleydawson / domain-event-dispatcher-bundle example snippets
$bundles = [
// ...
new AshleyDawson\DomainEventDispatcherBundle\AshleyDawsonDomainEventDispatcherBundle(),
];
namespace AppBundle\DomainEvent;
class MyDomainEvent
{
private $myEntityId;
public function __construct($myEntityId)
{
$this->myEntityId = $myEntityId;
}
public function getMyEntityId()
{
return $this->myEntityId;
}
}
namespace AppBundle\DomainEventListener;
use AppBundle\DomainEvent\MyDomainEvent;
class MyDomainEventListener
{
public function __invoke(MyDomainEvent $event)
{
// Do something with the event...
}
}
namespace AppBundle\Entity;
use AshleyDawson\DomainEventDispatcher\DomainEventDispatcher;
use AppBundle\DomainEvent\MyDomainEvent;
class MyEntity
{
private $id;
public function mySpecialCommand()
{
DomainEventDispatcher::getInstance()->dispatch(
new MyDomainEvent($this->id)
);
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.