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