X-Git-Url: https://git.rapsys.eu/.gitweb.cgi/userbundle/blobdiff_plain/b50edfff7f68b16418110a8ed17d6b514dc9d1c6..refs/heads/master:/Repository/UserRepository.php diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index ec5ffa3..27339b2 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -26,13 +26,13 @@ class UserRepository extends Repository implements PasswordUpgraderInterface { /** * Find user count as int * - * @return integer The keywords count + * @return integer The users count */ public function findCountAsInt(): int { //Set the request $req = <<addScalarResult('count', 'count', 'integer'); //Get result - return $this->_em + return $this->manager ->createNativeQuery($req, $rsm) ->getSingleScalarResult(); } @@ -76,11 +76,11 @@ FROM ( u.mail, u.forename, u.surname, - IFNULL(g.id, :guestid) AS g_id, - IFNULL(g.title, :guesttitle) AS g_title - FROM RapsysUserBundle:User AS u - LEFT JOIN RapsysUserBundle:UserGroup AS gu ON (gu.user_id = u.id) - LEFT JOIN RapsysUserBundle:Group AS g ON (g.id = gu.group_id) + g.id AS g_id, + g.title AS g_title + FROM Rapsys\UserBundle\Entity\User AS u + LEFT JOIN Rapsys\UserBundle\Entity\UserGroup AS gu ON (gu.user_id = u.id) + LEFT JOIN Rapsys\UserBundle\Entity\Group AS g ON (g.id = gu.group_id) ORDER BY NULL LIMIT 0, :limit ) AS t @@ -103,11 +103,10 @@ SQL; ->addScalarResult('mail', 'mail', 'string') ->addScalarResult('forename', 'forename', 'string') ->addScalarResult('surname', 'surname', 'string') - ->addScalarResult('g_id', 'g_id', 'integer') ->addScalarResult('g_title', 'g_title', 'string'); //Fetch result - $res = $this->_em + $res = $this->manager ->createNativeQuery($req, $rsm) ->setParameter('offset', $page * $count) ->setParameter('count', $count) @@ -119,7 +118,7 @@ SQL; //Process result foreach($res as $data) { //Get translated group - $group = $this->translator->trans($data['g_title'], [], $this->alias); + $group = $this->translator->trans($data['g_title']?:'Null', [], $this->alias); //Init group subarray if (!isset($ret[$group])) {