X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/849cc2e2bdd1b0c01d32e79d2d8d2fe862e89cd1..836d4b8cc091d5815e3f6dffe05532ac7137440d:/Repository/UserRepository.php diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index 5f5dd50..4e7dae8 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -13,8 +13,11 @@ namespace Rapsys\AirBundle\Repository; use Doctrine\ORM\AbstractQuery; use Doctrine\ORM\Query\ResultSetMapping; + use Symfony\Component\Routing\Generator\UrlGeneratorInterface; +use Rapsys\AirBundle\Repository; + /** * UserRepository */ @@ -38,9 +41,9 @@ FROM ( u.pseudonym, g.id AS g_id, g.title AS g_title - FROM RapsysAirBundle:User AS u - JOIN RapsysAirBundle:UserGroup AS gu ON (gu.user_id = u.id) - JOIN RapsysAirBundle:Group AS g ON (g.id = gu.group_id) + FROM Rapsys\AirBundle\Entity\User AS u + JOIN Rapsys\AirBundle\Entity\UserGroup AS gu ON (gu.user_id = u.id) + JOIN Rapsys\AirBundle\Entity\Group AS g ON (g.id = gu.group_id) WHERE g.title <> 'User' ORDER BY g.id DESC, u.pseudonym ASC LIMIT 0, :limit @@ -113,8 +116,8 @@ SELECT FROM ( SELECT u.id - FROM RapsysAirBundle:User AS u - LEFT JOIN RapsysAirBundle:UserGroup AS gu ON (gu.user_id = u.id) + FROM Rapsys\AirBundle\Entity\User AS u + LEFT JOIN Rapsys\AirBundle\Entity\UserGroup AS gu ON (gu.user_id = u.id) WHERE u.pseudonym IN (:pseudonym) ORDER BY gu.group_id DESC, u.pseudonym ASC LIMIT 0, :limit @@ -153,8 +156,8 @@ SQL; //Set the request $req =<< $id, 'user' => $this->slugger->slug($result['pseudonym'])]; @@ -280,7 +283,7 @@ SQL; //Milonga Raphaël exception if ($routeParams['id'] == 1 && $routeParams['user'] == 'milonga-raphael') { //Set route - $route = 'rapsys_air_user_milongaraphael'; + $route = 'rapsysair_user_milongaraphael'; //Set route params $routeParams = []; } @@ -323,7 +326,8 @@ SQL; //Iterate on each location foreach(explode("\n", $result['ids']) as $k => $id) { //Add role - $roles[$role = 'ROLE_'.strtoupper($titles[$k])] = $role; + //XXX: roles are keyes by id + $roles[$id] = 'ROLE_'.strtoupper($titles[$k]); //Add group $groups[$id] = $this->translator->trans($titles[$k]); @@ -399,14 +403,14 @@ FROM ( u.pseudonym, g.id AS g_id, g.title AS g_title - FROM RapsysAirBundle:User AS u - JOIN RapsysAirBundle:UserGroup AS gu ON (gu.user_id = u.id) - JOIN RapsysAirBundle:Group AS g ON (g.id = gu.group_id) + FROM Rapsys\AirBundle\Entity\User AS u + JOIN Rapsys\AirBundle\Entity\UserGroup AS gu ON (gu.user_id = u.id) + JOIN Rapsys\AirBundle\Entity\Group AS g ON (g.id = gu.group_id) ORDER BY NULL LIMIT 0, :limit ) AS c - LEFT JOIN RapsysAirBundle:Application AS a ON (a.user_id = c.id) - LEFT JOIN RapsysAirBundle:Dance AS d ON (d.id = a.dance_id) + LEFT JOIN Rapsys\AirBundle\Entity\Application AS a ON (a.user_id = c.id) + LEFT JOIN Rapsys\AirBundle\Entity\Dance AS d ON (d.id = a.dance_id) GROUP BY d.id ORDER BY NULL LIMIT 0, :limit @@ -469,8 +473,8 @@ SQL; 'dances' => [], 'slug' => $slug = $this->slugger->slug($data['pseudonym']), //Milonga Raphaël exception - 'link' => $data['id'] == 1 && $slug == 'milonga-raphael' ? $this->router->generate('rapsys_air_user_milongaraphael', []) : $this->router->generate('rapsys_air_user_view', ['id' => $data['id'], 'user' => $slug]), - 'edit' => $this->router->generate('rapsys_user_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)]) + 'link' => $data['id'] == 1 && $slug == 'milonga-raphael' ? $this->router->generate('rapsysair_user_milongaraphael', []) : $this->router->generate('rapsysair_user_view', ['id' => $data['id'], 'user' => $slug]), + 'edit' => $this->router->generate('rapsysuser_edit', ['mail' => $short = $this->slugger->short($data['mail']), 'hash' => $this->slugger->hash($short)]) ]; //With dances @@ -486,13 +490,13 @@ SQL; //Init dance when missing if (!isset($ret[$group][$data['id']]['dances'][$name = $this->translator->trans($names[$k])])) { $ret[$group][$data['id']]['dances'][$name] = [ - 'link' => $this->router->generate('rapsys_air_dance_name', ['name' => $this->slugger->short($names[$k]), 'dance' => $this->slugger->slug($name)]), + 'link' => $this->router->generate('rapsysair_dance_name', ['name' => $this->slugger->short($names[$k]), 'dance' => $this->slugger->slug($name)]), 'types' => [] ]; } //Set type - $ret[$group][$data['id']]['dances'][$name]['types'][$type = $this->translator->trans($types[$k])] = $this->router->generate('rapsys_air_dance_view', ['id' => $id, 'name' => $this->slugger->slug($name), 'type' => $this->slugger->slug($type)]); + $ret[$group][$data['id']]['dances'][$name]['types'][$type = $this->translator->trans($types[$k])] = $this->router->generate('rapsysair_dance_view', ['id' => $id, 'name' => $this->slugger->slug($name), 'type' => $this->slugger->slug($type)]); } } }