Fix
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
3837744b03
commit
44a0214187
|
|
@ -4,6 +4,7 @@ namespace DMD\LaLigaApi\Service\League\updateLeague;
|
|||
|
||||
use DMD\LaLigaApi\Dto\LeagueDto;
|
||||
use DMD\LaLigaApi\Entity\League;
|
||||
use DMD\LaLigaApi\Entity\User;
|
||||
use DMD\LaLigaApi\Repository\CustomRoleRepository;
|
||||
use DMD\LaLigaApi\Repository\LeagueRepository;
|
||||
use DMD\LaLigaApi\Repository\UserRepository;
|
||||
|
|
@ -32,8 +33,13 @@ class HandleUpdateLeague
|
|||
{
|
||||
$this->authorizeRequest->authorizeLeaguePresident($leagueId);
|
||||
$user = $this->security->getUser();
|
||||
if (!$user instanceof User)
|
||||
{
|
||||
throw new HttpException(Response::HTTP_UNAUTHORIZED, 'User not found');
|
||||
}
|
||||
$leagueEntity = $this->leagueRepository->find($leagueId);
|
||||
$leagueDto = new LeagueDto();
|
||||
$leagueDto->presidentId = $user->getId();
|
||||
$leagueDto->fillFromObject($leagueEntity);
|
||||
$leagueDto->fillFromArray($request->toArray());
|
||||
$leagueDto->validate();
|
||||
|
|
|
|||
Loading…
Reference in New Issue