Fix create season issues, add number of teams to season response array
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user