ogcore/src/Dto/Output/CommandTaskScriptOutput.php

42 lines
1.2 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\Get;
use App\Entity\CommandTaskSchedule;
use App\Entity\CommandTaskScript;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'CommandTaskScript')]
class CommandTaskScriptOutput extends AbstractOutput
{
#[Groups(['command-task-script:read'])]
public ?string $content = null;
#[Groups(['command-task-script:read'])]
public ?string $type = null;
#[Groups(['command-task-script:read'])]
public ?array $parameters = null;
#[Groups(['command-task-script:read'])]
public ?CommandTaskOutput $commandTaskOutput = null;
#[Groups(['command-task-script:read'])]
public ?int $order = null;
public function __construct(?CommandTaskScript $commandTaskScript = null)
{
parent::__construct($commandTaskScript);
if (!$commandTaskScript) {
return;
}
$this->content = $commandTaskScript->getContent();
$this->order = $commandTaskScript->getExecutionOrder();
$this->type = $commandTaskScript->getType();
$this->parameters = $commandTaskScript->getParameters();
$this->commandTaskOutput = new CommandTaskOutput($commandTaskScript->getCommandTask());
}
}