Fix create season issues, add number of teams to season response array
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good

This commit is contained in:
Daniel Guzman
2024-07-24 23:43:57 +02:00
parent 646e63a890
commit b1a3b47aaf
4 changed files with 13 additions and 2 deletions
+11
View File
@@ -14,6 +14,7 @@ class SeasonDto
public array $teamDtoList;
public array $facilityDtoList;
public int $leagueId;
public int $numberOfTeams;
public int $seasonNumber;
public int $gamesPerWeek;
public string $leagueName;
@@ -28,9 +29,15 @@ class SeasonDto
public function createSeasonArray(): array
{
$numberOfTeams = $this->numberOfTeams ?? 0;
if (!empty($this->teamDtoList))
{
$numberOfTeams = count($this->teamDtoList);
}
return [
'id' => $this->id ?? null,
'seasonNumber' => $this->seasonNumber ?? null,
'numberOfTeams' => $numberOfTeams,
'gamesPerWeek' => $this->gamesPerWeek ?? null,
'dateStart' => !empty($this->dateStart) ? $this->dateStart->format('Y-m'): null,
'leagueId' => $this->leagueId ?? null,
@@ -76,6 +83,10 @@ class SeasonDto
{
$this->active = $dataList['active'];
}
if (isset($dataList['numberOfTeams']))
{
$this->numberOfTeams = $dataList['numberOfTeams'];
}
if (isset($dataList['teamList']))
{
foreach ($dataList['teamList'] as $teamName)