welcome back to dyb-tech

This commit is contained in:
Daniel Guzman
2024-05-18 02:28:01 +02:00
parent 9513cdba09
commit 9f30bc98c7
6149 changed files with 668407 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
<?php
namespace DMD\LaLigaApi\Dto;
use DMD\LaLigaApi\Entity\File;
class FileDto
{
public int $id;
public string $name;
public string $type;
public \DateTime $createdAt;
public GameDto $gameDto;
public PlayerDto $playerDto;
public SeasonDto $seasonDto;
public function fillFromArray(array $dataList): void
{
if (isset($dataList['id']))
{
$this->id = $dataList['id'];
}
if (!empty($dataList['name']))
{
$this->name = $dataList['name'];
}
if (!empty($dataList['type']))
{
$this->type = $dataList['type'];
}
if (!empty($dataList['createdAt']))
{
$this->createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $dataList['createdAt']);
}
}
public function fillFromObject(File $fileEntity): void
{
if ($fileEntity->getId() !== null)
{
$this->id = $fileEntity->getId();
}
if ($fileEntity->getName() !== null)
{
$this->name = $fileEntity->getName();
}
if ($fileEntity->getPlayer() !== null)
{
$playerDto = new PlayerDto();
$playerDto->fillFromObject($fileEntity->getPlayer());
$this->playerDto = $playerDto;
}
if ($fileEntity->getSeason() !== null)
{
$seasonDto = new SeasonDto();
$seasonDto->fillFromObject($fileEntity->getSeason());
$this->seasonDto = $seasonDto;
}
if ($fileEntity->getGame() !== null)
{
$gameDto = new GameDto();
$gameDto->fillFromObject($fileEntity->getGame());
$this->gameDto = $gameDto;
}
}
public function validate(): void
{
}
}