fix role assign in league creation
dyb-tech.com/LaLiga-BackEnd/pipeline/head This commit looks good Details

This commit is contained in:
Daniel Guzman 2024-05-26 12:37:10 +02:00
parent 93df0e8ffd
commit d36cee95e6
1 changed files with 2 additions and 1 deletions

View File

@ -44,10 +44,10 @@ class HandleCreateLeague
$leagueDto->validate();
$leagueEntity = $this->leagueFactory::create($leagueDto);
$leagueEntity->setActive(true);
$this->assignPresidentRole($leagueEntity->getId(), $userEntity);
$this->entityManager->persist($leagueEntity);
$this->entityManager->flush();
$this->assignPresidentRole($leagueEntity->getId(), $userEntity);
$leagueDto->id = $leagueEntity->getId();
$leagueDto->createdAt = $leagueEntity->getCreatedAt();
@ -66,5 +66,6 @@ class HandleCreateLeague
$leaguePresidentRole->setEntityId($leagueId);
$leaguePresidentRole->setUser($userEntity);
$this->entityManager->persist($leaguePresidentRole);
$this->entityManager->flush();
}
}