Fix
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good

This commit is contained in:
2024-07-25 01:47:46 +02:00
parent cf9ea83f50
commit 327acd3c13
10 changed files with 242 additions and 16 deletions
-13
View File
@@ -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);
-1
View File
@@ -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;
}
}
}