Add games per week to season object and preferred day of week for team object
This commit is contained in:
@@ -13,6 +13,7 @@ class SeasonDto
|
||||
public array $facilityDtoList;
|
||||
public int $leagueId;
|
||||
public int $seasonNumber;
|
||||
public int $gamesPerWeek;
|
||||
public string $leagueName;
|
||||
public int $pointsPerWin;
|
||||
public int $pointsPerLoss;
|
||||
@@ -27,6 +28,7 @@ class SeasonDto
|
||||
return [
|
||||
'id' => $this->id ?? null,
|
||||
'seasonNumber' => $this->seasonNumber ?? null,
|
||||
'gamesPerWeek' => $this->gamesPerWeek ?? null,
|
||||
'dateStart' => !empty($this->dateStart) ? $this->dateStart->format('Y-m'): null,
|
||||
'leagueId' => $this->leagueId ?? null,
|
||||
'leagueName' => $this->leagueName ?? null,
|
||||
@@ -51,6 +53,10 @@ class SeasonDto
|
||||
$this->dateStart = $dateStart;
|
||||
}
|
||||
}
|
||||
if (isset($dataList['gamesPerWeek']))
|
||||
{
|
||||
$this->gamesPerWeek = (int) $dataList['gamesPerWeek'];
|
||||
}
|
||||
if (isset($dataList['pointsPerWin']))
|
||||
{
|
||||
$this->pointsPerWin = (int) $dataList['pointsPerWin'];
|
||||
@@ -115,6 +121,10 @@ class SeasonDto
|
||||
{
|
||||
$this->active = $leagueObj->isActive();
|
||||
}
|
||||
if ($leagueObj->getGamesPerWeek() !== null)
|
||||
{
|
||||
$this->gamesPerWeek = $leagueObj->getGamesPerWeek();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,6 +10,7 @@ class TeamDto
|
||||
{
|
||||
public int $id;
|
||||
public string $name;
|
||||
public string $dayOfWeekForHomeGame;
|
||||
public bool $active;
|
||||
public array $seasonDtoList;
|
||||
public array $playerDtoList;
|
||||
@@ -37,6 +38,7 @@ class TeamDto
|
||||
}
|
||||
return [
|
||||
'name' => $this->name ?? '',
|
||||
'dayOfWeekForHomeGame' => $this->dayOfWeekForHomeGame ?? '',
|
||||
'playerList' => $playerList,
|
||||
'seasonList' => $seasonList,
|
||||
'captainId' => $this->captainDto?->id,
|
||||
@@ -54,6 +56,10 @@ class TeamDto
|
||||
{
|
||||
$this->name = $dataList['name'];
|
||||
}
|
||||
if (!empty($dataList['dayOfWeekForHomeGame']))
|
||||
{
|
||||
$this->dayOfWeekForHomeGame = $dataList['dayOfWeekForHomeGame'];
|
||||
}
|
||||
if (isset($dataList['active']))
|
||||
{
|
||||
$this->active = $dataList['active'];
|
||||
@@ -98,6 +104,10 @@ class TeamDto
|
||||
{
|
||||
$this->name = $teamEntity->getName();
|
||||
}
|
||||
if ($teamEntity->getDayOfWeekForHomeGame())
|
||||
{
|
||||
$this->dayOfWeekForHomeGame = $teamEntity->getDayOfWeekForHomeGame();
|
||||
}
|
||||
if ($teamEntity->getPlayers())
|
||||
{
|
||||
foreach ($teamEntity->getPlayers() as $playerEntity)
|
||||
|
||||
Reference in New Issue
Block a user