ogcore/src/Dto/Output/ImageRepositoryOutput.php

38 lines
1.1 KiB
PHP

<?php
namespace App\Dto\Output;
use ApiPlatform\Metadata\Get;
use App\Entity\ImageRepository;
use Symfony\Component\Serializer\Annotation\Groups;
#[Get(shortName: 'ImageRepository')]
class ImageRepositoryOutput extends AbstractOutput
{
#[Groups(['repository:read', 'image:read', 'client:read', "organizational-unit:read", "image-image-repository:read"])]
public ?string $name = '';
#[Groups(['repository:read'])]
public ?string $ip = '';
#[Groups(['repository:read'])]
public ?string $comments = '';
#[Groups(['repository:read'])]
public \DateTime $createdAt;
#[Groups(['repository:read'])]
public ?string $createdBy = null;
public function __construct(ImageRepository $imageRepository, bool $status = true)
{
parent::__construct($imageRepository);
$this->name = $imageRepository->getName();
$this->ip = $imageRepository->getIp();
$this->comments = $imageRepository->getComments();
$this->createdAt = $imageRepository->getCreatedAt();
$this->createdBy = $imageRepository->getCreatedBy();
}
}