X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/3b7129d4925b8ade812f3e2100da9640f1ebb49e..b0ebe412a5442c597aa5c1dd0b141a1a90bdfa1c:/Repository/UserRepository.php diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index cc51ea0..9f112ee 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -85,7 +85,7 @@ class UserRepository extends \Doctrine\ORM\EntityRepository { //Process result foreach($res as $data) { //Get translated group - $group = $translator->trans($data['g_title']?:'ROLE_USER'); + $group = $translator->trans($data['g_title']?:'User'); //Get translated title $title = $translator->trans($data['t_short']); //Init group subarray @@ -100,4 +100,26 @@ class UserRepository extends \Doctrine\ORM\EntityRepository { //Send result return $ret; } + + /** + * Find all applicant by session + * + * @param $session The Session + */ + public function findAllApplicantBySession($session) { + //Get entity manager + $em = $this->getEntityManager(); + + //Fetch sessions + $ret = $this->getEntityManager() + ->createQuery('SELECT u.id, u.pseudonym FROM RapsysAirBundle:Application a JOIN RapsysAirBundle:User u WITH u.id = a.user WHERE a.session = :session') + ->setParameter('session', $session) + ->getResult(); + + //Process result + $ret = array_column($ret, 'id', 'pseudonym'); + + //Send result + return $ret; + } }