diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..13566b81 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/LaLiga-BackEnd.iml b/.idea/LaLiga-BackEnd.iml new file mode 100644 index 00000000..27371934 --- /dev/null +++ b/.idea/LaLiga-BackEnd.iml @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/material_theme_project_new.xml b/.idea/material_theme_project_new.xml new file mode 100644 index 00000000..1539cf78 --- /dev/null +++ b/.idea/material_theme_project_new.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 00000000..65edaf97 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/php.xml b/.idea/php.xml new file mode 100644 index 00000000..fea0745f --- /dev/null +++ b/.idea/php.xml @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Service/League/LeagueFactory.php b/src/Service/League/LeagueFactory.php index c9462e0e..72436e87 100644 --- a/src/Service/League/LeagueFactory.php +++ b/src/Service/League/LeagueFactory.php @@ -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; } } \ No newline at end of file diff --git a/src/Service/League/createLeague/HandleCreateLeague.php b/src/Service/League/createLeague/HandleCreateLeague.php index 67d2fa86..00739d9a 100644 --- a/src/Service/League/createLeague/HandleCreateLeague.php +++ b/src/Service/League/createLeague/HandleCreateLeague.php @@ -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); diff --git a/src/Service/Season/SeasonFactory.php b/src/Service/Season/SeasonFactory.php index 16739a07..1ac6e5e5 100644 --- a/src/Service/Season/SeasonFactory.php +++ b/src/Service/Season/SeasonFactory.php @@ -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); diff --git a/src/Service/Season/createSeason/HandleCreateSeason.php b/src/Service/Season/createSeason/HandleCreateSeason.php index df33c56c..e3bc5b69 100644 --- a/src/Service/Season/createSeason/HandleCreateSeason.php +++ b/src/Service/Season/createSeason/HandleCreateSeason.php @@ -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; } } }