@@ -22,18 +22,6 @@ class LeagueFactory
|
||||
{
|
||||
$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);
|
||||
@@ -54,7 +42,6 @@ class LeagueFactory
|
||||
{
|
||||
$leagueEntity->setIsPublic(true);
|
||||
}
|
||||
$leagueEntity->setActive(true);
|
||||
return $leagueEntity;
|
||||
}
|
||||
}
|
||||
@@ -44,7 +44,7 @@ class HandleCreateLeague
|
||||
$leagueDto->validate();
|
||||
$leagueDto->active = true;
|
||||
$leagueEntity = $this->leagueFactory::create($leagueDto);
|
||||
|
||||
$leagueEntity->setActive(true);
|
||||
$this->entityManager->persist($leagueEntity);
|
||||
$this->entityManager->flush();
|
||||
$this->assignPresidentRole($leagueEntity->getId(), $userEntity);
|
||||
|
||||
@@ -11,7 +11,6 @@ class SeasonFactory
|
||||
public static function create(SeasonDto $seasonDto): Season
|
||||
{
|
||||
$seasonEntity = new Season();
|
||||
$seasonEntity->setActive(true);
|
||||
if (!empty($seasonDto->dateStart))
|
||||
{
|
||||
$seasonEntity->setDateStart($seasonDto->dateStart);
|
||||
|
||||
@@ -72,16 +72,23 @@ class HandleCreateSeason
|
||||
);
|
||||
}
|
||||
|
||||
private function createTeams(int $numberOfTeams, Season $seasonEntity): void
|
||||
private function createTeams(int $numberOfTeams, Season $seasonEntity, SeasonDto $seasonDto): void
|
||||
{
|
||||
if (!empty($numberOfTeams))
|
||||
{
|
||||
for ($i = 0; $i < $numberOfTeams; $i++)
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamEntity = new Team();
|
||||
$teamEntity->addSeason($seasonEntity);
|
||||
$teamEntity->setName('Equipo '. $i+1);
|
||||
$teamDto->name = $teamEntity->getName();
|
||||
$teamDto->active = true;
|
||||
$teamEntity->setActive(true);
|
||||
$this->entityManager->persist($teamEntity);
|
||||
$this->entityManager->flush();
|
||||
$teamDto->id = $teamEntity->getId();
|
||||
$seasonDto->teamDtoList[] = $teamDto;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user