]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Repository/UserRepository.php
Check on slot id unnecessary joining and title fetching
[airbundle] / Repository / UserRepository.php
index 0d0ee4e45e2ff35c06e0da72be4922cf6f80219f..9f112ee10e322ba2656ea393ad83bd0956ba809d 100644 (file)
@@ -100,4 +100,26 @@ class UserRepository extends \Doctrine\ORM\EntityRepository {
                //Send result
                return $ret;
        }
                //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;
+       }
 }
 }