File size: 679 Bytes
cf14c12 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <?php
declare(strict_types=1);
namespace Stat\Application\Commands;
use DateTime;
use DateTimeInterface;
use Shared\Infrastructure\CommandBus\Attributes\Handler;
use Stat\Application\CommandHandlers\ReadStatCommandHandler;
use Stat\Domain\ValueObjects\StatType;
#[Handler(ReadStatCommandHandler::class)]
class ReadStatCommand
{
public StatType $type;
public ?DateTimeInterface $year = null;
public ?DateTimeInterface $month = null;
public ?DateTimeInterface $day = null;
public function __construct(string|StatType $type)
{
$this->type = $type instanceof StatType ? $type : StatType::from($type);
$this->day = new DateTime();
}
}
|