]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Repository/UserRepository.php
Add score and canceled field
[airbundle] / Repository / UserRepository.php
index cc51ea088d565510b1a753dfb8722afdeddabcd1..8b490c47abf4f19135959b157c432312f602cb14 100644 (file)
@@ -85,7 +85,7 @@ class UserRepository extends \Doctrine\ORM\EntityRepository {
                //Process result
                foreach($res as $data) {
                        //Get translated group
                //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
                        //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;
        }
                //Send result
                return $ret;
        }
+
+       /**
+        * Find all user's pseudonym from session applications
+        *
+        * @param $session The Session instance
+        */
+       public function findAllPseudonymBySession($session) {
+               //Get entity manager
+               $em = $this->getEntityManager();
+
+               //Fetch sessions
+               $ret = $this->getEntityManager()
+                       ->createQuery('SELECT u.id, u.pseudonym FROM RapsysAirBundle:Application a INNER JOIN RapsysAirBundle:User u WHERE u.id = a.user AND a.session = :session')
+                       ->setParameter('session', $session)
+                       ->getResult();
+
+               //Process result
+               $ret = array_column($ret, 'pseudonym', 'id');
+
+               //Send result
+               return $ret;
+       }
 }
 }