welcome back to dyb-tech
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
namespace DMD\LaLigaApi\Service\League;
|
||||
|
||||
use DMD\LaLigaApi\Dto\LeagueDto;
|
||||
use DMD\LaLigaApi\Entity\League;
|
||||
|
||||
class LeagueFactory
|
||||
{
|
||||
public static function create(LeagueDto $leagueDto): League
|
||||
{
|
||||
$leagueEntity = new League();
|
||||
if (!empty($leagueDto->name))
|
||||
{
|
||||
$leagueEntity->setName($leagueDto->name);
|
||||
}
|
||||
if (!empty($leagueDto->logo))
|
||||
{
|
||||
$leagueEntity->setLogo($leagueDto->logo);
|
||||
}
|
||||
if (!empty($leagueDto->description))
|
||||
{
|
||||
$leagueEntity->setDescription($leagueDto->description);
|
||||
}
|
||||
if (isset($leagueDto->pointsPerWin))
|
||||
{
|
||||
$leagueEntity->setPointsPerWin($leagueDto->pointsPerWin);
|
||||
}
|
||||
if (!empty($leagueDto->pointsPerDraw))
|
||||
{
|
||||
$leagueEntity->setPointsPerDraw($leagueDto->pointsPerDraw);
|
||||
}
|
||||
if (!empty($leagueDto->pointsPerLoss))
|
||||
{
|
||||
$leagueEntity->setPointsPerLoss($leagueDto->pointsPerLoss);
|
||||
}
|
||||
if (!empty($leagueDto->matchesBetweenTeams))
|
||||
{
|
||||
$leagueEntity->setMatchesBetweenTeams($leagueDto->matchesBetweenTeams);
|
||||
}
|
||||
if (!empty($leagueDto->blockedMatchDates))
|
||||
{
|
||||
$leagueEntity->setBlockedMatchDates($leagueDto->blockedMatchDates);
|
||||
}
|
||||
if (!empty($leagueDto->city))
|
||||
{
|
||||
$leagueEntity->setCity($leagueDto->city);
|
||||
}
|
||||
$leagueEntity->setActive(true);
|
||||
return $leagueEntity;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user