Get All Leagues, Get All Teams, Add Teams
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good
Details
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good
Details
This commit is contained in:
parent
4cdc3c38ef
commit
7bfb300a59
|
|
@ -40,14 +40,25 @@ class HandleAddTeam
|
|||
'Temporada con ID: '. $seasonId .' no ha sido encontrada.'
|
||||
);
|
||||
}
|
||||
$teamDto = new TeamDto();
|
||||
$teamDto->fillFromArray($request->toArray());
|
||||
if (!empty($request->toArray()))
|
||||
{
|
||||
$teamDtoList = [];
|
||||
foreach ($request->toArray() as $teamItem)
|
||||
{
|
||||
$teamDto = $this->teamFactory::createDtoFromArray($teamItem);
|
||||
$teamDto->validate();
|
||||
$teamEntity = $this->teamFactory::create($teamDto);
|
||||
$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: [
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<?php
|
||||
|
||||
namespace DMD\LaLigaApi\Service\Season\getAllTeams;
|
||||
|
||||
class HandleGetAllTeams
|
||||
{
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue