]> Raphaël G. Git Repositories - userbundle/commitdiff
Remove defaultgroup
authorRaphaël Gertz <git@rapsys.eu>
Sun, 3 Nov 2024 01:07:44 +0000 (02:07 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Sun, 3 Nov 2024 01:07:44 +0000 (02:07 +0100)
Attribute user without group to the fake Null group

Repository/UserRepository.php

index 85dad143a28d42cf18156aa83b1c89ef090ce3c7..7f9d5713d59cb879907925c7ac78fd1facd70bb2 100644 (file)
@@ -76,8 +76,8 @@ FROM (
                u.mail,
                u.forename,
                u.surname,
                u.mail,
                u.forename,
                u.surname,
-               IFNULL(g.id, 0) AS g_id,
-               IFNULL(g.title, :defaultgroup) AS g_title
+               g.id AS g_id,
+               g.title 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)
        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)
@@ -118,7 +118,7 @@ SQL;
                //Process result
                foreach($res as $data) {
                        //Get translated group
                //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])) {
 
                        //Init group subarray
                        if (!isset($ret[$group])) {