Files
cheeper-ddd-cqrs-example/src/Cheeper/Chapter7/Application/Author/Event/WhenNewAuthorSignedThenCreateTimelineProjectionEventHandler.php
Carlos Buenosvinos 6559597db5 [Chapter9] WIP
2022-03-07 15:12:28 +01:00

29 lines
947 B
PHP

<?php
declare(strict_types=1);
namespace Cheeper\Chapter7\Application\Author\Event;
use Cheeper\Chapter7\Application\Author\Projection\CreateFollowersCounterProjection;
use Cheeper\Chapter7\Application\Author\Projection\CreateFollowersCounterProjectionHandlerInterface;
use Cheeper\Chapter7\Application\Author\Projection\CreateTimelineProjection;
use Cheeper\Chapter7\Application\Author\Projection\CreateTimelineProjectionHandlerInterface;
use Cheeper\Chapter7\DomainModel\Author\NewAuthorSigned;
final class WhenNewAuthorSignedThenCreateTimelineProjectionEventHandler
{
public function __construct(
private CreateTimelineProjectionHandlerInterface $projector
) {
}
public function handle(NewAuthorSigned $event): void
{
$this->projector->__invoke(
CreateTimelineProjection::ofAuthor(
$event->authorId(),
$event->authorUsername()
)
);
}
}