This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ class GameDto
|
||||
'awayTeam' => $this->awayTeamDto->toArray() ?? [],
|
||||
'plannedDate' => !empty($this->plannedDate) ? $this->plannedDate->format('Y-m-d H:i:s') : null,
|
||||
'gameDateTime' => !empty($this->gameDateTime) ? $this->gameDateTime->format('Y-m-d H:i:s') : null,
|
||||
'season' => $this->seasonDto->toArray() ?? [],
|
||||
'season' => $this->seasonDto->createSeasonArray() ?? [],
|
||||
'notes' => $this->notes ?? null,
|
||||
'facility' => $this->facilityDto->toArray() ?? [],
|
||||
'pointsHome' => $this->pointsHome ?? 0,
|
||||
|
||||
+9
-20
@@ -12,6 +12,8 @@ class SeasonDto
|
||||
public array $teamDtoList;
|
||||
public array $facilityDtoList;
|
||||
public int $leagueId;
|
||||
public int $seasonNumber;
|
||||
public string $leagueName;
|
||||
public int $pointsPerWin;
|
||||
public int $pointsPerLoss;
|
||||
public int $pointsPerDraw;
|
||||
@@ -20,30 +22,17 @@ class SeasonDto
|
||||
public bool $active;
|
||||
public array $validationErrors;
|
||||
|
||||
public function toArray(): array
|
||||
public function createSeasonArray(): array
|
||||
{
|
||||
$teamList = [];
|
||||
$facilityList = [];
|
||||
if (!empty($this->teamDtoList))
|
||||
{
|
||||
foreach ($this->teamDtoList as $teamDto)
|
||||
{
|
||||
$teamList[] = $teamDto->toArray();
|
||||
}
|
||||
}
|
||||
if (!empty($this->facilityDtoList))
|
||||
{
|
||||
foreach ($this->facilityDtoList as $facilityDto)
|
||||
{
|
||||
$facilityList[] = $facilityDto->toArray();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'id' => $this->id ?? null,
|
||||
'seasonNumber' => $this->seasonNumber ?? null,
|
||||
'dateStart' => !empty($this->dateStart) ? $this->dateStart->format('Y-m'): null,
|
||||
'leagueId' => $this->leagueId ?? null,
|
||||
'teamList' => $teamList,
|
||||
'facilityList' => $facilityList,
|
||||
'leagueName' => $this->leagueName ?? null,
|
||||
'pointsPerWin' => $this->pointsPerWin ?? null,
|
||||
'pointsPerDraw' => $this->pointsPerDraw ?? null,
|
||||
'pointsPerLoss' => $this->pointsPerLoss ?? null,
|
||||
'active' => $this->active ?? null
|
||||
];
|
||||
}
|
||||
@@ -56,7 +45,7 @@ class SeasonDto
|
||||
}
|
||||
if (!empty($dataList['dateStart']))
|
||||
{
|
||||
$dateStart = \DateTime::createFromFormat('Y-m' ,$dataList['dateStart']);
|
||||
$dateStart = \DateTime::createFromFormat('Y-m', $dataList['dateStart']);
|
||||
if ($dateStart)
|
||||
{
|
||||
$this->dateStart = $dateStart;
|
||||
|
||||
Reference in New Issue
Block a user