ogcore/src/Dto/Output/CommandOutput.php

41 lines
1019 B
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\Get;
use App\Entity\Command;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'Command')]
final class CommandOutput extends AbstractOutput
{
#[Groups(['command:read'])]
public string $name;
#[Groups(['command:read'])]
public ?string $script = '';
#[Groups(['command:read'])]
public ?bool $readOnly = false;
#[Groups(['command:read'])]
public ?string $comments = '';
#[Groups(['command:read'])]
public \DateTime $createdAt;
#[Groups(['command:read'])]
public ?string $createdBy = null;
public function __construct(Command $command)
{
parent::__construct($command);
$this->name = $command->getName();
$this->script = $command->getScript();
$this->readOnly = $command->isReadOnly();
$this->comments = $command->getComments();
$this->createdAt = $command->getCreatedAt();
$this->createdBy = $command->getCreatedBy();
}
}