From: Raphaƫl Gertz Date: Sun, 3 Nov 2024 01:07:44 +0000 (+0100) Subject: Remove defaultgroup X-Git-Tag: 0.5.3~4 X-Git-Url: https://git.rapsys.eu/userbundle/commitdiff_plain/1a77a16689da402450798a8ae1db92f43d911de8?ds=inline;hp=45a5c17fb68fb988c8a480015a4813ba1aec4982 Remove defaultgroup Attribute user without group to the fake Null group --- diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index 85dad14..7f9d571 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -76,8 +76,8 @@ FROM ( 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) @@ -118,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])) {