task: adds event log module

This commit is contained in:
Brock H Caldwell
2025-11-01 15:27:21 -05:00
parent f5732fbcea
commit 6fbd56c952
9 changed files with 259 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
<?php
namespace App\EventLog\Action\Handler;
use App\EventLog\Framework\Repository\EventLogRepository;
use App\EventLog\Action\Command\AddEventLogCommand;
use App\EventLog\Action\Result\AddEventLogResult;
use OneToMany\RichBundle\Contract\CommandInterface;
use OneToMany\RichBundle\Contract\HandlerInterface;
use OneToMany\RichBundle\Contract\ResultInterface;
/*** @implements HandlerInterface<AddEventLogCommand> */
class AddEventLogHandler implements HandlerInterface
{
public function __construct(
private EventLogRepository $repository,
) {}
public function handle(CommandInterface $command): ResultInterface
{
$eventLog = $this->repository->insert(
type: $command->type,
message: $command->message,
context: $command->context
);
return new AddEventLogResult($eventLog);
}
}