89 lines
2.5 KiB
PHP
89 lines
2.5 KiB
PHP
<?php
|
|
|
|
namespace App\Dto\Output;
|
|
|
|
use ApiPlatform\Metadata\Get;
|
|
use App\Entity\Image;
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
|
|
#[Get(shortName: 'Image')]
|
|
final class ImageOutput extends AbstractOutput
|
|
{
|
|
#[Groups(['image:read'])]
|
|
public ?string $name = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $description = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $comments = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $type = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $path = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $revision = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $info = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?int $size = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?bool $remotePc = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?bool $isGlobal = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?bool $created = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?SoftwareProfileOutput $softwareProfile = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?ImageRepositoryOutput $imageRepository = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?array $partitionInfo = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $imageFullsum = '';
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $status = null;
|
|
|
|
#[Groups(['image:read'])]
|
|
public \DateTime $createdAt;
|
|
|
|
#[Groups(['image:read'])]
|
|
public ?string $createdBy = null;
|
|
|
|
public function __construct(Image $image)
|
|
{
|
|
parent::__construct($image);
|
|
|
|
$this->name = $image->getName();
|
|
$this->description = $image->getDescription();
|
|
$this->comments = $image->getComments();
|
|
$this->type = $image->getType();
|
|
$this->path = $image->getPath();
|
|
$this->revision = $image->getRevision();
|
|
$this->info = $image->getInfo();
|
|
$this->size = $image->getSize();
|
|
$this->imageFullsum = $image->getImageFullsum();
|
|
$this->status = $image->getStatus();
|
|
$this->softwareProfile = $image->getSoftwareProfile() ? new SoftwareProfileOutput($image->getSoftwareProfile()) : null;
|
|
$this->imageRepository = $image->getRepository() ? new ImageRepositoryOutput($image->getRepository()) : null;
|
|
$this->partitionInfo = json_decode($image->getPartitionInfo(), true);
|
|
$this->remotePc = $image->isRemotePc();
|
|
$this->isGlobal = $image->isGlobal();
|
|
$this->created = $image->isCreated();
|
|
$this->createdAt = $image->getCreatedAt();
|
|
$this->createdBy = $image->getCreatedBy();
|
|
}
|
|
} |