Initial commit
This commit is contained in:
35
src/Event/MessengerEventBus.php
Normal file
35
src/Event/MessengerEventBus.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* This file is part of the zapoyok.info project.
|
||||
* (c) <zapoyok.info> <jerome.fix@zapoyok.info>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Zapoyok\CQRSBundle\Event;
|
||||
|
||||
use Scc\CQRSBundle\DomainModel\DomainEventInterface;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
||||
final class MessengerEventBus implements EventBusInterface
|
||||
{
|
||||
public function __construct(private MessageBusInterface $eventBus)
|
||||
{
|
||||
}
|
||||
|
||||
public function notify(DomainEventInterface $event): void
|
||||
{
|
||||
$this->eventBus->dispatch($event);
|
||||
}
|
||||
|
||||
public function notifyAll(array $domainEvents): void
|
||||
{
|
||||
foreach ($domainEvents as $element) {
|
||||
$this->notify($element);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user