37 lines
957 B
PHP
37 lines
957 B
PHP
<?php
|
|
|
|
namespace App\EventLog\Action\Input;
|
|
|
|
use App\EventLog\Action\Command\AddEventLogCommand;
|
|
use OneToMany\RichBundle\Attribute\SourceQuery;
|
|
use OneToMany\RichBundle\Attribute\SourceRequest;
|
|
use OneToMany\RichBundle\Contract\CommandInterface;
|
|
use OneToMany\RichBundle\Contract\InputInterface;
|
|
|
|
/** @implements InputInterface<AddEventLogCommand> */
|
|
class AddEventLogInput implements InputInterface
|
|
{
|
|
public function __construct(
|
|
#[SourceQuery('type')]
|
|
#[SourceRequest('type')]
|
|
public string $type,
|
|
|
|
#[SourceQuery('message')]
|
|
#[SourceRequest('message')]
|
|
public string $message,
|
|
|
|
#[SourceQuery('context')]
|
|
#[SourceRequest('context')]
|
|
public array $context = []
|
|
){}
|
|
|
|
public function toCommand(): CommandInterface
|
|
{
|
|
return new AddEventLogCommand(
|
|
$this->type,
|
|
$this->message,
|
|
$this->context
|
|
);
|
|
}
|
|
}
|