ogcore/src/Dto/Input/GitImageRepositoryInput.php

33 lines
840 B
PHP

<?php
namespace App\Dto\Input;
use App\Entity\GitImageRepository;
use App\Entity\ImageImageRepository;
use Symfony\Component\Serializer\Annotation\Groups;
final class GitImageRepositoryInput
{
#[Groups(['git-image-repository:write'])]
public ?string $description = '';
public function __construct(?GitImageRepository $gitImageRepository = null)
{
if (!$gitImageRepository) {
return;
}
$this->description = $gitImageRepository->getDescription();
}
public function createOrUpdateEntity(?GitImageRepository $gitImageRepository = null): GitImageRepository
{
if (!$gitImageRepository) {
$gitImageRepository = new GitImageRepository();
}
$gitImageRepository->setDescription($this->description);
return $gitImageRepository;
}
}