feat: event listener sur MangaCreated pour ajouter les chapitres à la création
This commit is contained in:
parent
879b8fa2dc
commit
73774f84ff
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Domain\Manga\Infrastructure\EventListener;
|
||||
|
||||
use App\Domain\Manga\Application\Command\FetchMangaChapters;
|
||||
use App\Domain\Manga\Domain\Event\MangaCreated;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
|
||||
readonly class MangaCreatedListener
|
||||
{
|
||||
public function __construct(
|
||||
private MessageBusInterface $messageBus
|
||||
) {}
|
||||
|
||||
public function __invoke(MangaCreated $event): void
|
||||
{
|
||||
$this->messageBus->dispatch(
|
||||
new FetchMangaChapters($event->externalId)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user