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.'
|
'Temporada con ID: '. $seasonId .' no ha sido encontrada.'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$teamDto = new TeamDto();
|
if (!empty($request->toArray()))
|
||||||
$teamDto->fillFromArray($request->toArray());
|
{
|
||||||
$teamDto->validate();
|
$teamDtoList = [];
|
||||||
$teamEntity = $this->teamFactory::create($teamDto);
|
foreach ($request->toArray() as $teamItem)
|
||||||
$teamEntity->addSeason($seasonEntity);
|
{
|
||||||
$this->entityManager->persist($teamEntity);
|
$teamDto = $this->teamFactory::createDtoFromArray($teamItem);
|
||||||
$this->entityManager->flush();
|
$teamDto->validate();
|
||||||
$teamDto->id = $teamEntity->getId();
|
$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(
|
return new JsonResponse(
|
||||||
data: [
|
data: [
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace DMD\LaLigaApi\Service\Season\getAllTeams;
|
||||||
|
|
||||||
|
class HandleGetAllTeams
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue