44 lines
1.3 KiB
PHP
44 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Dto\Input;
|
|
|
|
use ApiPlatform\Metadata\ApiProperty;
|
|
use App\Dto\Output\ImageOutput;
|
|
use App\Dto\Output\ImageRepositoryOutput;
|
|
use App\Entity\ImageImageRepository;
|
|
use App\Entity\PxeTemplate;
|
|
use Symfony\Component\Serializer\Annotation\Groups;
|
|
use Symfony\Component\Validator\Constraints as Assert;
|
|
|
|
final class ImageImageRepositoryInput
|
|
{
|
|
#[Groups(['image-image-repository:write'])]
|
|
public ?string $description = '';
|
|
|
|
#[Groups(['image-image-repository:write'])]
|
|
#[ApiProperty(description: 'Whether this image is available for Remote PC in this repository', example: false)]
|
|
public ?bool $remotePc = false;
|
|
|
|
public function __construct(?ImageImageRepository $imageImageRepository = null)
|
|
{
|
|
if (!$imageImageRepository) {
|
|
return;
|
|
}
|
|
|
|
$this->description = $imageImageRepository->getDescription();
|
|
$this->remotePc = $imageImageRepository->isRemotePc();
|
|
}
|
|
|
|
public function createOrUpdateEntity(?ImageImageRepository $imageImageRepository = null): ImageImageRepository
|
|
{
|
|
if (!$imageImageRepository) {
|
|
$imageImageRepository = new ImageImageRepository();
|
|
}
|
|
|
|
$imageImageRepository->setDescription($this->description);
|
|
$imageImageRepository->setRemotePc($this->remotePc);
|
|
|
|
return $imageImageRepository;
|
|
}
|
|
}
|