This commit is contained in:
@@ -49,6 +49,7 @@ class LeagueController extends AbstractController
|
||||
{
|
||||
return $handleGetLeagueById($request, $leagueId);
|
||||
}
|
||||
|
||||
#[Route('/api/public/league', name: 'app_get_all_leagues', methods: ['GET'])]
|
||||
public function getAllLeagues(HandleGetAllLeagues $handleGetAllLeagues): JsonResponse
|
||||
{
|
||||
|
||||
@@ -2,11 +2,12 @@
|
||||
|
||||
namespace DMD\LaLigaApi\Controller;
|
||||
|
||||
use DMD\LaLigaApi\Service\Season\addTeam\HandleAddTeam;
|
||||
use DMD\LaLigaApi\Service\Season\addTeam\HandleAddTeamList;
|
||||
use DMD\LaLigaApi\Service\Season\createFacilities\HandleCreateFacilities;
|
||||
use DMD\LaLigaApi\Service\Season\createGameCalendar\HandleCreateGameCalendarRequest;
|
||||
use DMD\LaLigaApi\Service\Season\createSeason\HandleCreateSeason;
|
||||
use DMD\LaLigaApi\Service\Season\getAllFacilities\HandleGetAllFacilities;
|
||||
use DMD\LaLigaApi\Service\Season\getAllTeams\HandleGetAllTeams;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -21,10 +22,15 @@ class SeasonController extends AbstractController
|
||||
}
|
||||
|
||||
#[Route('/api/league/{leagueId}/season/{seasonId}/team', name: 'app_add_team', methods: ['POST'])]
|
||||
public function addTeam(Request $request, HandleAddTeam $handleAddTeam, int $leagueId, int $seasonId): JsonResponse
|
||||
public function addTeam(Request $request, HandleAddTeamList $handleAddTeam, int $leagueId, int $seasonId): JsonResponse
|
||||
{
|
||||
return $handleAddTeam($request, $leagueId, $seasonId);
|
||||
}
|
||||
#[Route('/api/league/{leagueId}/season/{seasonId}/team', name: 'app_get_all_teams', methods: ['GET'])]
|
||||
public function getAllTeam(Request $request, HandleGetAllTeams $handleGetAllTeams, int $leagueId, int $seasonId): JsonResponse
|
||||
{
|
||||
return $handleGetAllTeams($request, $leagueId, $seasonId);
|
||||
}
|
||||
#[Route('/api/league/{leagueId}/season/{seasonId}/facilities/create', name: 'app_create_facilities', methods: ['POST'])]
|
||||
public function createFacilities(Request $request, HandleCreateFacilities $handleCreateFacilities, int $leagueId, int $seasonId): JsonResponse
|
||||
{
|
||||
|
||||
@@ -66,7 +66,7 @@ class FacilityDto
|
||||
}
|
||||
}
|
||||
|
||||
public function fillFromObject(Facility $facilityEntity): void
|
||||
public function fillFromEntity(Facility $facilityEntity): void
|
||||
{
|
||||
if ($facilityEntity->getId() !== null)
|
||||
{
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ class FileDto
|
||||
if ($fileEntity->getSeason() !== null)
|
||||
{
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($fileEntity->getSeason());
|
||||
$seasonDto->fillFromEntity($fileEntity->getSeason());
|
||||
$this->seasonDto = $seasonDto;
|
||||
}
|
||||
if ($fileEntity->getGame() !== null)
|
||||
|
||||
+4
-4
@@ -93,25 +93,25 @@ class GameDto
|
||||
if ($gameEntity->getSeason() !== null)
|
||||
{
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($gameEntity->getSeason());
|
||||
$seasonDto->fillFromEntity($gameEntity->getSeason());
|
||||
$this->seasonDto = $seasonDto;
|
||||
}
|
||||
if ($gameEntity->getFacility() !== null)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromObject($gameEntity->getFacility());
|
||||
$facilityDto->fillFromEntity($gameEntity->getFacility());
|
||||
$this->facilityDto = $facilityDto;
|
||||
}
|
||||
if ($gameEntity->getHomeTeam() !== null)
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromObject($gameEntity->getHomeTeam());
|
||||
$teamDto->fillFromEntity($gameEntity->getHomeTeam());
|
||||
$this->homeTeamDto = $teamDto;
|
||||
}
|
||||
if ($gameEntity->getAwayTeam() !== null)
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromObject($gameEntity->getAwayTeam());
|
||||
$teamDto->fillFromEntity($gameEntity->getAwayTeam());
|
||||
$this->awayTeamDto = $teamDto;
|
||||
}
|
||||
if ($gameEntity->getFiles() !== null)
|
||||
|
||||
@@ -155,7 +155,7 @@ class LeagueDto
|
||||
foreach ($leagueObj->getSeasons() as $seasonObj)
|
||||
{
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($seasonObj);
|
||||
$seasonDto->fillFromEntity($seasonObj);
|
||||
$this->seasonDtoList[] = $seasonDto;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class PlayerDto
|
||||
if ($playerEntity->getTeam() !== null)
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromObject($playerEntity->getTeam());
|
||||
$teamDto->fillFromEntity($playerEntity->getTeam());
|
||||
$this->teamDto = $teamDto;
|
||||
}
|
||||
if ($playerEntity->getFiles() !== null)
|
||||
|
||||
+56
-10
@@ -3,12 +3,14 @@
|
||||
namespace DMD\LaLigaApi\Dto;
|
||||
|
||||
use DMD\LaLigaApi\Entity\Season;
|
||||
use DMD\LaLigaApi\Entity\Team;
|
||||
use DMD\LaLigaApi\Exception\ValidationException;
|
||||
|
||||
class SeasonDto
|
||||
{
|
||||
public int $id;
|
||||
public \DateTime $dateStart;
|
||||
public \DateTime $createdAt;
|
||||
public array $teamDtoList;
|
||||
public array $facilityDtoList;
|
||||
public int $leagueId;
|
||||
@@ -22,6 +24,7 @@ class SeasonDto
|
||||
public array $seasonDataDtoList;
|
||||
public bool $active;
|
||||
public array $validationErrors;
|
||||
public int $matchesBetweenTeams;
|
||||
|
||||
public function createSeasonArray(): array
|
||||
{
|
||||
@@ -102,28 +105,71 @@ class SeasonDto
|
||||
}
|
||||
}
|
||||
|
||||
public function fillFromObject(Season $seasonObj): void
|
||||
public function fillFromEntity(Season $seasonEntity): void
|
||||
{
|
||||
if ($seasonObj->getId() !== null)
|
||||
if ($seasonEntity->getId() !== null)
|
||||
{
|
||||
$this->id = $seasonObj->getId();
|
||||
$this->id = $seasonEntity->getId();
|
||||
}
|
||||
if ($seasonObj->getDateStart() !== null)
|
||||
if ($seasonEntity->getDateStart() !== null)
|
||||
{
|
||||
$this->dateStart = new \DateTime($seasonObj->getDateStart()->format('Y-m'));
|
||||
$this->dateStart = $seasonEntity->getDateStart();
|
||||
}
|
||||
$leagueObj = $seasonObj->getLeague();
|
||||
$leagueObj = $seasonEntity->getLeague();
|
||||
if ($leagueObj !== null)
|
||||
{
|
||||
$this->leagueId = $leagueObj->getId();
|
||||
}
|
||||
if ($leagueObj->isActive() !== null)
|
||||
if ($seasonEntity->isActive() !== null)
|
||||
{
|
||||
$this->active = $leagueObj->isActive();
|
||||
$this->active = $seasonEntity->isActive();
|
||||
}
|
||||
if ($leagueObj->getGamesPerWeek() !== null)
|
||||
if ($seasonEntity->getTeams())
|
||||
{
|
||||
$this->gamesPerWeek = $leagueObj->getGamesPerWeek();
|
||||
foreach ($seasonEntity->getTeams() as $teamEntity)
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromEntity($teamEntity);
|
||||
$this->teamDtoList[] = $teamDto;
|
||||
}
|
||||
}
|
||||
if ($seasonEntity->getFacilities())
|
||||
{
|
||||
foreach ($seasonEntity->getFacilities() as $facilityEntity)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromEntity($facilityEntity);
|
||||
$this->facilityDtoList[] = $facilityDto;
|
||||
}
|
||||
}
|
||||
if ($seasonEntity->getGames())
|
||||
{
|
||||
foreach ($seasonEntity->getGames() as $gameEntity)
|
||||
{
|
||||
$gameDto = new GameDto();
|
||||
$gameDto->fillFromObject($gameEntity);
|
||||
$this->gameDtoList[] = $gameDto;
|
||||
}
|
||||
}
|
||||
if ($seasonEntity->getCreatedAt())
|
||||
{
|
||||
$this->createdAt = \DateTime::createFromFormat('Y-m-d H:i:s', $seasonEntity->getCreatedAt()->format('Y-m-d H:i:s'));
|
||||
}
|
||||
if ($seasonEntity->getPointsPerWin())
|
||||
{
|
||||
$this->pointsPerWin = $seasonEntity->getPointsPerWin();
|
||||
}
|
||||
if ($seasonEntity->getPointsPerLoss())
|
||||
{
|
||||
$this->pointsPerLoss = $seasonEntity->getPointsPerLoss();
|
||||
}
|
||||
if ($seasonEntity->getPointsPerDraw())
|
||||
{
|
||||
$this->pointsPerDraw = $seasonEntity->getPointsPerDraw();
|
||||
}
|
||||
if ($seasonEntity->getGamesPerWeek())
|
||||
{
|
||||
$this->gamesPerWeek = $seasonEntity->getGamesPerWeek();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+29
-25
@@ -11,38 +11,25 @@ class TeamDto
|
||||
public int $id;
|
||||
public string $name;
|
||||
public string $dayOfWeekForHomeGame;
|
||||
public string $logo;
|
||||
public bool $active;
|
||||
public int $leagueId;
|
||||
public array $seasonDtoList;
|
||||
public array $playerDtoList;
|
||||
public array $validationErrors;
|
||||
public UserDto $captainDto;
|
||||
public \DateTimeImmutable $createdAt;
|
||||
public UserDto $captainDto;
|
||||
public array $validationErrors;
|
||||
|
||||
public function toArray(): array
|
||||
{
|
||||
$seasonList = [];
|
||||
$playerList = [];
|
||||
if (!empty($this->seasonDtoList))
|
||||
{
|
||||
foreach ($this->seasonDtoList as $seasonDto)
|
||||
{
|
||||
$seasonList = $seasonDto->toArray();
|
||||
}
|
||||
}
|
||||
if (!empty($this->playerDtoList))
|
||||
{
|
||||
foreach ($this->playerDtoList as $playerDto)
|
||||
{
|
||||
$playerList = $playerDto->toArray();
|
||||
}
|
||||
}
|
||||
return [
|
||||
'id' => $this->id ?? '',
|
||||
'name' => $this->name ?? '',
|
||||
'dayOfWeekForHomeGame' => $this->dayOfWeekForHomeGame ?? '',
|
||||
'playerList' => $playerList,
|
||||
'seasonList' => $seasonList,
|
||||
'captainId' => $this->captainDto?->id,
|
||||
'createdAt' => $this->createdAt->format('Y-m-d')
|
||||
'logo' => $this->logo ?? '',
|
||||
'captainName'=> isset($this->captainDto) ? $this->captainDto->firstName . ' ' . $this->captainDto->lastName : 'No asignado',
|
||||
'captainId'=> isset($this->captainDto) ? $this->captainDto->id : 'No asignado',
|
||||
|
||||
];
|
||||
}
|
||||
|
||||
@@ -64,6 +51,14 @@ class TeamDto
|
||||
{
|
||||
$this->active = $dataList['active'];
|
||||
}
|
||||
if (isset($dataList['logo']))
|
||||
{
|
||||
$this->logo = $dataList['logo'];
|
||||
}
|
||||
if (isset($dataList['leagueId']))
|
||||
{
|
||||
$this->leagueId = (int) $dataList['leagueId'];
|
||||
}
|
||||
if (!empty($dataList['seasonList']))
|
||||
{
|
||||
foreach ($dataList['seasonList'] as $seasonItem)
|
||||
@@ -94,7 +89,7 @@ class TeamDto
|
||||
}
|
||||
}
|
||||
|
||||
public function fillFromObject(Team $teamEntity): void
|
||||
public function fillFromEntity(Team $teamEntity): void
|
||||
{
|
||||
if ($teamEntity->getId())
|
||||
{
|
||||
@@ -104,9 +99,9 @@ class TeamDto
|
||||
{
|
||||
$this->name = $teamEntity->getName();
|
||||
}
|
||||
if ($teamEntity->getDayOfWeekForHomeGame())
|
||||
if ($teamEntity->getDayOfTheWeekForHomeGame())
|
||||
{
|
||||
$this->dayOfWeekForHomeGame = $teamEntity->getDayOfWeekForHomeGame();
|
||||
$this->dayOfWeekForHomeGame = $teamEntity->getDayOfTheWeekForHomeGame();
|
||||
}
|
||||
if ($teamEntity->getPlayers())
|
||||
{
|
||||
@@ -117,6 +112,15 @@ class TeamDto
|
||||
$this->playerDtoList[] = $playerDto;
|
||||
}
|
||||
}
|
||||
if ($teamEntity->getTeamLogo())
|
||||
{
|
||||
$this->logo = $teamEntity->getTeamLogo();
|
||||
}
|
||||
if ($teamEntity->getCaptain())
|
||||
{
|
||||
$this->captainDto = new UserDto;
|
||||
$this->captainDto->fillFromObject($teamEntity->getCaptain());
|
||||
}
|
||||
if ($teamEntity->getCreatedAt())
|
||||
{
|
||||
$this->createdAt = $teamEntity->getCreatedAt();
|
||||
|
||||
@@ -43,6 +43,12 @@ class Team
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $dayOfTheWeekForHomeGame = null;
|
||||
|
||||
#[ORM\Column(nullable: true)]
|
||||
private ?int $leagueId = null;
|
||||
|
||||
#[ORM\Column(length: 255, nullable: true)]
|
||||
private ?string $teamLogo = null;
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->seasons = new ArrayCollection();
|
||||
@@ -214,4 +220,28 @@ class Team
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getLeagueId(): ?int
|
||||
{
|
||||
return $this->leagueId;
|
||||
}
|
||||
|
||||
public function setLeagueId(?int $leagueId): static
|
||||
{
|
||||
$this->leagueId = $leagueId;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTeamLogo(): ?string
|
||||
{
|
||||
return $this->teamLogo;
|
||||
}
|
||||
|
||||
public function setTeamLogo(?string $teamLogo): static
|
||||
{
|
||||
$this->teamLogo = $teamLogo;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,14 +7,42 @@ use DMD\LaLigaApi\Entity\Team;
|
||||
|
||||
class TeamFactory
|
||||
{
|
||||
public static function create(TeamDto $teamDto): Team
|
||||
public static function createEntityFromDto(TeamDto $teamDto): Team
|
||||
{
|
||||
$teamEntity = new Team();
|
||||
if (!empty($teamDto->name))
|
||||
{
|
||||
$teamEntity->setName($teamDto->name);
|
||||
}
|
||||
$teamEntity->setActive(true);
|
||||
if (!empty($teamDto->dayOfWeekForHomeGame))
|
||||
{
|
||||
$teamEntity->setDayOfTheWeekForHomeGame($teamDto->dayOfWeekForHomeGame);
|
||||
}
|
||||
if (!empty($teamDto->logo))
|
||||
{
|
||||
$teamEntity->setTeamLogo($teamDto->logo);
|
||||
}
|
||||
if (!empty($teamDto->active))
|
||||
{
|
||||
$teamEntity->setActive($teamDto->active);
|
||||
}
|
||||
if (!empty($teamDto->leagueId))
|
||||
{
|
||||
$teamEntity->setLeagueId($teamDto->leagueId);
|
||||
}
|
||||
return $teamEntity;
|
||||
}
|
||||
public static function createDtoFromEntity(Team $teamEntity): TeamDto
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromEntity($teamEntity);
|
||||
return $teamDto;
|
||||
}
|
||||
public static function createDtoFromArray(array $teamArray): TeamDto
|
||||
{
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromArray($teamArray);
|
||||
$teamDto->active = true;
|
||||
return $teamDto;
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class HandleAddTeam
|
||||
class HandleAddTeamList
|
||||
{
|
||||
public function __construct(
|
||||
public AuthorizeRequest $authorizeRequest,
|
||||
@@ -40,30 +40,27 @@ class HandleAddTeam
|
||||
'Temporada con ID: '. $seasonId .' no ha sido encontrada.'
|
||||
);
|
||||
}
|
||||
if (!empty($request->toArray()))
|
||||
if (empty($request->toArray()))
|
||||
{
|
||||
$teamDtoList = [];
|
||||
foreach ($request->toArray() as $teamItem)
|
||||
{
|
||||
$teamDto = $this->teamFactory::createDtoFromArray($teamItem);
|
||||
$teamDto->validate();
|
||||
$teamEntity = $this->teamFactory::createEntityFromDto($teamDto);
|
||||
$teamEntity->addSeason($seasonEntity);
|
||||
$teamEntity->setLeagueId($leagueId);
|
||||
$this->entityManager->persist($teamEntity);
|
||||
$this->entityManager->flush();
|
||||
$teamDto->id = $teamEntity->getId();
|
||||
$teamDtoList[] = $teamDto->toArray();
|
||||
}
|
||||
|
||||
throw new HttpException(Response::HTTP_BAD_REQUEST, 'Empty request.');
|
||||
}
|
||||
$teamDtoList = [];
|
||||
foreach ($request->toArray() as $teamItem)
|
||||
{
|
||||
$teamDto = $this->teamFactory::createDtoFromArray($teamItem);
|
||||
$teamDto->validate();
|
||||
$teamEntity = $this->teamFactory::createEntityFromDto($teamDto);
|
||||
$teamEntity->addSeason($seasonEntity);
|
||||
$teamEntity->setLeagueId($leagueId);
|
||||
$this->entityManager->persist($teamEntity);
|
||||
$this->entityManager->flush();
|
||||
$teamDto->id = $teamEntity->getId();
|
||||
$teamDtoList[] = $teamDto->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
return new JsonResponse(
|
||||
data: [
|
||||
'success' => true,
|
||||
'team' => $teamDto->toArray()
|
||||
'team' => $teamDtoList
|
||||
],
|
||||
status: Response::HTTP_OK
|
||||
);
|
||||
|
||||
@@ -60,7 +60,7 @@ class HandleCreateFacilities
|
||||
foreach ($facilityEntityList as $facilityEntity)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromObject($facilityEntity);
|
||||
$facilityDto->fillFromEntity($facilityEntity);
|
||||
$facilityResponseArray[] = $facilityDto->toArray();
|
||||
}
|
||||
return new JsonResponse(
|
||||
|
||||
@@ -293,10 +293,10 @@ class HandleCreateGameCalendarRequest
|
||||
{
|
||||
$gameDto = new GameDto();
|
||||
$homeTeamDto = new TeamDto();
|
||||
$homeTeamDto->fillFromObject($homeTeamEntity);
|
||||
$homeTeamDto->fillFromEntity($homeTeamEntity);
|
||||
$gameDto->homeTeamDto = $homeTeamDto;
|
||||
$awayTeamDto = new TeamDto();
|
||||
$awayTeamDto->fillFromObject($awayTeamEntity);
|
||||
$awayTeamDto->fillFromEntity($awayTeamEntity);
|
||||
$gameDto->awayTeamDto = $awayTeamDto;
|
||||
return $gameDto;
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ class HandleGetAllFacilities
|
||||
foreach ($facilityCollection as $facilityObj)
|
||||
{
|
||||
$facilityDto = new FacilityDto();
|
||||
$facilityDto->fillFromObject($facilityObj);
|
||||
$facilityDto->fillFromEntity($facilityObj);
|
||||
$facilityArray[] = $facilityDto->toArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ class HandleGetAllSeason
|
||||
foreach ($seasonCollection as $seasonObj)
|
||||
{
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($seasonObj);
|
||||
$seasonDto->fillFromEntity($seasonObj);
|
||||
$seasonArray[] = $seasonDto->createSeasonArray();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,58 @@
|
||||
|
||||
namespace DMD\LaLigaApi\Service\Season\getAllTeams;
|
||||
|
||||
use DMD\LaLigaApi\Repository\LeagueRepository;
|
||||
use DMD\LaLigaApi\Repository\SeasonRepository;
|
||||
use DMD\LaLigaApi\Repository\TeamRepository;
|
||||
use DMD\LaLigaApi\Service\Common\TeamFactory;
|
||||
use Symfony\Component\HttpFoundation\JsonResponse;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\HttpException;
|
||||
|
||||
class HandleGetAllTeams
|
||||
{
|
||||
public function __construct(
|
||||
public TeamRepository $teamRepository,
|
||||
public SeasonRepository $seasonRepository,
|
||||
public LeagueRepository $leagueRepository,
|
||||
public TeamFactory $teamFactory,
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke(Request $request ,int $leagueId, int $seasonId): JsonResponse
|
||||
{
|
||||
$leagueEntity = $this->leagueRepository->find($leagueId);
|
||||
$seasonEntity = $this->seasonRepository->findOneBy([
|
||||
'id' => $seasonId,
|
||||
'league' => $leagueEntity
|
||||
]);
|
||||
if (is_null($seasonEntity))
|
||||
{
|
||||
throw new HttpException(Response::HTTP_NOT_FOUND, "Season not found");
|
||||
}
|
||||
$teamEntityCollection = $this->teamRepository->findBy([
|
||||
'leagueId' => $leagueId,
|
||||
'active' => true
|
||||
]);
|
||||
if (empty($teamEntityCollection))
|
||||
{
|
||||
return new JsonResponse([
|
||||
'success' => true,
|
||||
'teams' => []
|
||||
], Response::HTTP_OK);
|
||||
}
|
||||
$teamArray = [];
|
||||
foreach ($teamEntityCollection as $teamEntity)
|
||||
{
|
||||
$teamArray[] = ($this->teamFactory::createDtoFromEntity($teamEntity))->toArray();
|
||||
}
|
||||
return new JsonResponse(
|
||||
[
|
||||
'success' => true,
|
||||
'teams' => $teamArray
|
||||
], Response::HTTP_OK
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -32,7 +32,7 @@ class HandleGetSeasonById
|
||||
);
|
||||
}
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($seasonObj);
|
||||
$seasonDto->fillFromEntity($seasonObj);
|
||||
return new JsonResponse(
|
||||
data: [
|
||||
'success' => true,
|
||||
|
||||
@@ -30,7 +30,7 @@ class HandleUpdateSeason
|
||||
{
|
||||
$seasonObj = $this->checkUserAuthorization($leagueId, $seasonId);
|
||||
$seasonDto = new SeasonDto();
|
||||
$seasonDto->fillFromObject($seasonObj);
|
||||
$seasonDto->fillFromEntity($seasonObj);
|
||||
$seasonDto->fillFromArray($request->toArray());
|
||||
$seasonDto->validate();
|
||||
if (!empty($seasonDto->validationErrors))
|
||||
|
||||
Reference in New Issue
Block a user