X-Git-Url: https://git.rapsys.eu/userbundle/blobdiff_plain/0811e272814cf05d6fc8bc76646a0be99bf79bb9..23944f72bf54cef447e2034434e1c5df303f3083:/Repository/UserRepository.php?ds=inline diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index 077b500..6cb6cc3 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -32,7 +32,7 @@ class UserRepository extends Repository implements PasswordUpgraderInterface { //Set the request $req = <<replace($req); //Get result set mapping instance - //XXX: DEBUG: see ../blog.orig/src/Rapsys/UserBundle/Repository/ArticleRepository.php + //XXX: DEBUG: see ../blog.orig/src/Rapsys/BlogBundle/Repository/ArticleRepository.php $rsm = new ResultSetMapping(); //Declare all fields @@ -96,13 +103,7 @@ SQL; ->addScalarResult('mail', 'mail', 'string') ->addScalarResult('forename', 'forename', 'string') ->addScalarResult('surname', 'surname', 'string') - ->addScalarResult('pseudonym', 'pseudonym', 'string') - ->addScalarResult('c_id', 'c_id', 'integer') - ->addScalarResult('c_title', 'c_title', 'string') - //XXX: is a string because of \n separator - ->addScalarResult('g_ids', 'g_ids', 'string') - //XXX: is a string because of \n separator - ->addScalarResult('g_titles', 'g_titles', 'string'); + ->addScalarResult('g_title', 'g_title', 'string'); //Fetch result $res = $this->_em @@ -116,32 +117,22 @@ SQL; //Process result foreach($res as $data) { + //Get translated group + $group = $this->translator->trans($data['g_title']?:'Null', [], $this->alias); + + //Init group subarray + if (!isset($ret[$group])) { + $ret[$group] = []; + } + //Set data - $ret[$data['id']] = [ + $ret[$group][$data['id']] = [ 'mail' => $data['mail'], 'forename' => $data['forename'], 'surname' => $data['surname'], - 'pseudonym' => $data['pseudonym'], - 'groups' => [], - 'slug' => $this->slugger->slug($data['pseudonym']), - 'link' => $this->router->generate('rapsysuser_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)]) + //Milonga Raphaël exception + 'edit' => $this->router->generate('rapsysuser_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)]) ]; - - //With groups - if (!empty($data['g_ids'])) { - //Set titles - $titles = explode("\n", $data['g_titles']); - - //Iterate on each group - foreach(explode("\n", $data['g_ids']) as $k => $id) { - //Add group - $ret[$data['id']]['groups'][$id] = [ - 'title' => $group = $this->translator->trans($titles[$k]), - #'slug' => $this->slugger->slug($group) - #'link' => $this->router->generate('rapsysuser_group_view', ['id' => $id, 'slug' => $this->slugger->short($group)]) - ]; - } - } } //Send result