feat: event listener sur MangaCreated pour ajouter les chapitres à la création

This commit is contained in:
ext.jeremy.guillot@maxicoffee.domains
2025-02-11 18:28:30 +01:00
parent 879b8fa2dc
commit 73774f84ff
10 changed files with 83 additions and 24 deletions

View File

@@ -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)
);
}
}