Exemplo n.º 1
0
 /**
  * BaseReport constructor.
  *
  * @param BaseReportBuilder $builder
  *
  * @throws \Assert\AssertionFailedException
  */
 public function __construct(BaseReportBuilder $builder)
 {
     $id = $builder->getId();
     Assertion::uuid($id);
     $this->id = $id;
     $name = $builder->getName();
     Assertion::string($name);
     Assertion::notEmpty($name);
     $this->name = $name;
     $description = $builder->getDescription();
     Assertion::nullOrString($description);
     $this->setDescription($description);
     $gitLab = $builder->getGitLab();
     Assertion::isInstanceOf($gitLab, GitLab::class);
     $this->gitLab = $gitLab;
 }
 /**
  * Получить сущность на основе dto
  *
  * @param BaseReportDto $baseReportDto
  *
  * @return BaseReport
  * @throws \Assert\AssertionFailedException
  */
 public function toEntity(BaseReportDto $baseReportDto)
 {
     $modelBuilder = new BaseReportBuilder();
     return $modelBuilder->setId($baseReportDto->getId())->setDescription($baseReportDto->getDescription())->setName($baseReportDto->getName())->setGitLab($this->getGitLabRepository()->get($baseReportDto->getGitLabId()))->build();
 }