ogcore/src/Dto/Output/CommandTaskScheduleOutput.php

41 lines
1.3 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\Get;
use App\Entity\CommandTaskSchedule;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'CommandTaskSchedule')]
class CommandTaskScheduleOutput extends AbstractOutput
{
#[Groups(['command-task-schedule:read'])]
public ?string $recurrenceType = null;
#[Groups(['command-task-schedule:read'])]
public ?\DateTimeInterface $executionDate = null;
#[Groups(['command-task-schedule:read'])]
public ?\DateTimeInterface $executionTime = null;
#[Groups(['command-task-schedule:read'])]
public ?array $recurrenceDetails = null;
#[Groups(['command-task-schedule:read'])]
public ?bool $enabled = null;
public function __construct(?CommandTaskSchedule $commandTaskSchedule = null)
{
parent::__construct($commandTaskSchedule);
if (!$commandTaskSchedule) {
return;
}
$this->recurrenceType = $commandTaskSchedule->getRecurrenceType();
$this->executionTime = $commandTaskSchedule->getExecutionTime();
$this->executionDate = $commandTaskSchedule->getExecutionDate();
$this->recurrenceDetails = $commandTaskSchedule->getRecurrenceDetails();
$this->enabled = $commandTaskSchedule->isEnabled();
}
}