ogcore/src/Dto/Output/TraceOutput.php

50 lines
1.3 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\Get;
use App\Entity\Menu;
use App\Entity\Trace;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'Trace')]
final class TraceOutput extends AbstractOutput
{
#[Groups(['trace:read'])]
public CommandOutput $command;
#[Groups(['trace:read'])]
public ClientOutput $client;
#[Groups(['trace:read'])]
public string $status;
#[Groups(['trace:read'])]
public ?\DateTimeInterface $executedAt = null;
#[Groups(['trace:read'])]
public ?string $output = null;
#[Groups(['trace:read'])]
public ?\DateTimeInterface $finishedAt = null;
#[Groups(['trace:read'])]
public \DateTime $createdAt;
#[Groups(['trace:read'])]
public ?string $createdBy = null;
public function __construct(Trace $trace)
{
parent::__construct($trace);
$this->command = new CommandOutput($trace->getCommand());
$this->client = new ClientOutput($trace->getClient());
$this->status = $trace->getStatus();
$this->executedAt = $trace->getExecutedAt();
$this->output = $trace->getOutput();
$this->finishedAt = $trace->getFinishedAt();
$this->createdAt = $trace->getCreatedAt();
$this->createdBy = $trace->getCreatedBy();
}
}