ogcore/src/Dto/Output/PxeBootFileOutput.php

42 lines
1.1 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\Get;
use App\Entity\Client;
use App\Entity\PxeBootFile;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'PxeBootFile')]
final class PxeBootFileOutput extends AbstractOutput
{
#[Groups(['pxe-boot-file:read'])]
public PxeTemplateOutput $template;
#[Groups(['pxe-boot-file:read'])]
public array $clients;
#[Groups(['pxe-boot-file:read'])]
public ?bool $synchronized = null;
#[Groups(['pxe-boot-file:read'])]
public \DateTime $createdAt;
#[Groups(['pxe-boot-file:read'])]
public ?string $createdBy = null;
public function __construct(PxeBootFile $bootFile)
{
parent::__construct($bootFile);
$this->template = new PxeTemplateOutput($bootFile->getTemplate());
$this->clients = $bootFile->getClients()->map(
fn(Client $client) => new ClientOutput($client)
)->toArray();
$this->synchronized = $bootFile->isSynchronized();
$this->createdAt = $bootFile->getCreatedAt();
$this->createdBy = $bootFile->getCreatedBy();
}
}