]> Raphaël G. Git Repositories - airbundle/blobdiff - Repository/UserRepository.php
Rename rapsysair:calendar2 command to rapsysair:calendar
[airbundle] / Repository / UserRepository.php
index 39185516d7f45c61d2e0a9129485cc6919766d52..725e3ed3f482e3a08001d9f523549bb7ce4cfacc 100644 (file)
@@ -218,9 +218,9 @@ SELECT
        c.title AS c_title,
        u.country_id AS o_id,
        o.title AS o_title,
+       GREATEST(u.created, u.updated, COALESCE(c.created, '1970-01-01'), COALESCE(c.updated, '1970-01-01'), COALESCE(o.created, '1970-01-01'), COALESCE(o.updated, '1970-01-01'), COALESCE(g.created, '1970-01-01'), COALESCE(g.updated, '1970-01-01')) AS modified,
        GROUP_CONCAT(g.id ORDER BY g.id SEPARATOR "\\n") AS ids,
-       GROUP_CONCAT(g.title ORDER BY g.id SEPARATOR "\\n") AS titles,
-       GREATEST(COALESCE(u.updated, 0), COALESCE(c.updated, 0), COALESCE(o.updated, 0)) AS modified
+       GROUP_CONCAT(g.title ORDER BY g.id SEPARATOR "\\n") AS titles
 FROM Rapsys\AirBundle\Entity\User AS u
 LEFT JOIN Rapsys\AirBundle\Entity\Civility AS c ON (c.id = u.civility_id)
 LEFT JOIN Rapsys\AirBundle\Entity\Country AS o ON (o.id = u.country_id)
@@ -252,11 +252,11 @@ SQL;
                        ->addScalarResult('c_title', 'c_title', 'string')
                        ->addScalarResult('o_id', 'o_id', 'integer')
                        ->addScalarResult('o_title', 'o_title', 'string')
+                       ->addScalarResult('modified', 'modified', 'datetime')
                        //XXX: is a string because of \n separator
                        ->addScalarResult('ids', 'ids', 'string')
                        //XXX: is a string because of \n separator
                        ->addScalarResult('titles', 'titles', 'string')
-                       ->addScalarResult('modified', 'modified', 'datetime')
                        ->addIndexByScalar('id');
 
                //Get result
@@ -275,7 +275,7 @@ SQL;
                $result['alternates'] = [];
 
                //Set route
-               $route = 'rapsys_air_user_view';
+               $route = 'rapsysair_user_view';
 
                //Set route params
                $routeParams = ['id' => $id, 'user' => $this->slugger->slug($result['pseudonym'])];
@@ -283,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 = [];
                }
@@ -473,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
@@ -490,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)]);
                                }
                        }
                }