From: Raphaël Gertz Date: Thu, 29 Feb 2024 14:08:00 +0000 (+0100) Subject: Use entity full namespace instead of dropped entity short syntax X-Git-Tag: 0.3.0~30 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/3acf23dca54927ce3131a617756cf3d6e641c792?ds=sidebyside Use entity full namespace instead of dropped entity short syntax --- diff --git a/Repository/ApplicationRepository.php b/Repository/ApplicationRepository.php index 3112d14..57acc37 100644 --- a/Repository/ApplicationRepository.php +++ b/Repository/ApplicationRepository.php @@ -15,7 +15,7 @@ class ApplicationRepository extends \Doctrine\ORM\EntityRepository { public function findOneBySessionUser($session, $user) { //Fetch article $ret = $this->getEntityManager() - ->createQuery('SELECT a FROM RapsysAirBundle:Application a WHERE (a.session = :session AND a.user = :user)') + ->createQuery('SELECT a FROM Rapsys\AirBundle\Entity\Application a WHERE (a.session = :session AND a.user = :user)') ->setParameter('session', $session) ->setParameter('user', $user) ->getSingleResult(); diff --git a/Repository/DanceRepository.php b/Repository/DanceRepository.php index 6f64e92..98a6ee9 100644 --- a/Repository/DanceRepository.php +++ b/Repository/DanceRepository.php @@ -32,7 +32,7 @@ SELECT d.id, d.name, d.type -FROM RapsysAirBundle:Dance AS d +FROM Rapsys\AirBundle\Entity\Dance AS d SQL; //Replace bundle entity name by table name @@ -45,7 +45,7 @@ SQL; //Declare all fields //XXX: see vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php //addScalarResult($sqlColName, $resColName, $type = 'string'); - $rsm->addEntityResult('RapsysAirBundle:Dance', 'd') + $rsm->addEntityResult('Rapsys\AirBundle\Entity\Dance', 'd') ->addFieldResult('d', 'id', 'id') ->addFieldResult('d', 'name', 'name') ->addFieldResult('d', 'type', 'type') @@ -69,7 +69,7 @@ SELECT d.name, GROUP_CONCAT(d.id ORDER BY d.id SEPARATOR "\\n") AS ids, GROUP_CONCAT(d.type ORDER BY d.id SEPARATOR "\\n") AS types -FROM RapsysAirBundle:Dance AS d +FROM Rapsys\AirBundle\Entity\Dance AS d GROUP BY d.name ORDER BY d.name SQL; @@ -133,7 +133,7 @@ SQL; $req = <<addEntityResult('RapsysAirBundle:Dance', 'd'); + $rsm->addEntityResult('Rapsys\AirBundle\Entity\Dance', 'd'); $rsm->addFieldResult('d', 'id', 'id'); $rsm->addFieldResult('d', 'name', 'name'); $rsm->addFieldResult('d', 'type', 'type'); diff --git a/Repository/GoogleTokenRepository.php b/Repository/GoogleTokenRepository.php index 3ddced2..fa2a854 100644 --- a/Repository/GoogleTokenRepository.php +++ b/Repository/GoogleTokenRepository.php @@ -39,8 +39,8 @@ SELECT GROUP_CONCAT(c.mail ORDER BY c.id SEPARATOR "\\n") AS cmails, GROUP_CONCAT(c.summary ORDER BY c.id SEPARATOR "\\n") AS csummaries, GROUP_CONCAT(IFNULL(c.synchronized, 'NULL') ORDER BY c.id SEPARATOR "\\n") AS csynchronizeds -FROM RapsysAirBundle:GoogleToken AS t -JOIN RapsysAirBundle:GoogleCalendar AS c ON (c.google_token_id = t.id) +FROM Rapsys\AirBundle\Entity\GoogleToken AS t +JOIN Rapsys\AirBundle\Entity\GoogleCalendar AS c ON (c.google_token_id = t.id) GROUP BY t.id ORDER BY NULL SQL; diff --git a/Repository/LocationRepository.php b/Repository/LocationRepository.php index 9a67b9c..1ac821c 100644 --- a/Repository/LocationRepository.php +++ b/Repository/LocationRepository.php @@ -51,8 +51,8 @@ SELECT l.longitude, l.indoor, l.updated -FROM RapsysAirBundle:Location AS l -LEFT JOIN RapsysAirBundle:Session AS s ON (l.id = s.location_id) +FROM Rapsys\AirBundle\Entity\Location AS l +LEFT JOIN Rapsys\AirBundle\Entity\Session AS s ON (l.id = s.location_id) GROUP BY l.id ORDER BY COUNT(IF(s.date BETWEEN :begin AND :end, s.id, NULL)) DESC, COUNT(s.id) DESC, l.id SQL; @@ -138,8 +138,8 @@ FROM ( l.zipcode, COUNT(s.id) AS count, COUNT(IF(s.date BETWEEN :begin AND :end, s.id, NULL)) AS pcount - FROM RapsysAirBundle:Location AS l - LEFT JOIN RapsysAirBundle:Session AS s ON (l.id = s.location_id) + FROM Rapsys\AirBundle\Entity\Location AS l + LEFT JOIN Rapsys\AirBundle\Entity\Session AS s ON (l.id = s.location_id) GROUP BY l.id ORDER BY NULL LIMIT 0, :limit @@ -271,7 +271,7 @@ SELECT ROUND(AVG(l.latitude), 6) AS latitude, ROUND(AVG(l.longitude), 6) AS longitude, MAX(l.updated) AS updated -FROM RapsysAirBundle:Location AS l +FROM Rapsys\AirBundle\Entity\Location AS l GROUP BY city, SUBSTRING(l.zipcode, 1, 3) ORDER BY ACOS(SIN(RADIANS(:latitude))*SIN(RADIANS(l.latitude))+COS(RADIANS(:latitude))*COS(RADIANS(l.latitude))*COS(RADIANS(:longitude - l.longitude)))*40030.17/2/PI() LIMIT 0, 1 @@ -370,11 +370,11 @@ FROM ( l.latitude, l.longitude, l.updated - FROM RapsysAirBundle:Location AS l + FROM Rapsys\AirBundle\Entity\Location AS l WHERE l.latitude BETWEEN :minlat AND :maxlat AND l.longitude BETWEEN :minlong AND :maxlong LIMIT 0, :limit ) AS a -LEFT JOIN RapsysAirBundle:Session s ON (s.location_id = a.id) +LEFT JOIN Rapsys\AirBundle\Entity\Session s ON (s.location_id = a.id) GROUP BY a.id ORDER BY COUNT(IF(s.date BETWEEN :begin AND :end, s.id, NULL)) DESC, count DESC, a.id SQL; @@ -589,8 +589,8 @@ SELECT SUBSTRING(l.zipcode, 1, 2) AS city_id, ROUND(AVG(l2.latitude), 6) AS city_latitude, ROUND(AVG(l2.longitude), 6) AS city_longitude -FROM RapsysAirBundle:Location AS l -JOIN RapsysAirBundle:Location AS l2 ON (l2.city = l.city AND SUBSTRING(l.zipcode, 1, 3) = SUBSTRING(l.zipcode, 1, 3)) +FROM Rapsys\AirBundle\Entity\Location AS l +JOIN Rapsys\AirBundle\Entity\Location AS l2 ON (l2.city = l.city AND SUBSTRING(l.zipcode, 1, 3) = SUBSTRING(l.zipcode, 1, 3)) WHERE l.id = :id GROUP BY l.id LIMIT 0, 1 @@ -706,7 +706,7 @@ SQL; public function findComplementBySessionId(int $id): array { //Fetch complement locations $ret = $this->getEntityManager() - ->createQuery('SELECT l.id, l.title FROM RapsysAirBundle:Session s LEFT JOIN RapsysAirBundle:Session s2 WITH s2.id != s.id AND s2.slot = s.slot AND s2.date = s.date LEFT JOIN RapsysAirBundle:Location l WITH l.id != s.location AND (l.id != s2.location OR s2.location IS NULL) WHERE s.id = :sid GROUP BY l.id ORDER BY l.id') + ->createQuery('SELECT l.id, l.title FROM Rapsys\AirBundle\Entity\Session s LEFT JOIN Rapsys\AirBundle\Entity\Session s2 WITH s2.id != s.id AND s2.slot = s.slot AND s2.date = s.date LEFT JOIN Rapsys\AirBundle\Entity\Location l WITH l.id != s.location AND (l.id != s2.location OR s2.location IS NULL) WHERE s.id = :sid GROUP BY l.id ORDER BY l.id') ->setParameter('sid', $id) ->getArrayResult(); @@ -728,8 +728,8 @@ SQL; public function findByUserId(int $userId): array { //Set the request $req = 'SELECT l.id, l.title -FROM RapsysAirBundle:UserLocation AS ul -JOIN RapsysAirBundle:Location AS l ON (l.id = ul.location_id) +FROM Rapsys\AirBundle\Entity\UserLocation AS ul +JOIN Rapsys\AirBundle\Entity\Location AS l ON (l.id = ul.location_id) WHERE ul.user_id = :id'; //Replace bundle entity name by table name @@ -740,7 +740,7 @@ WHERE ul.user_id = :id'; $rsm = new ResultSetMapping(); //Declare result set for our request - $rsm->addEntityResult('RapsysAirBundle:Location', 'l') + $rsm->addEntityResult('Rapsys\AirBundle\Entity\Location', 'l') ->addFieldResult('l', 'id', 'id') ->addFieldResult('l', 'title', 'title'); diff --git a/Repository/SessionRepository.php b/Repository/SessionRepository.php index 971b227..13318fb 100644 --- a/Repository/SessionRepository.php +++ b/Repository/SessionRepository.php @@ -114,16 +114,16 @@ SELECT GROUP_CONCAT(IFNULL(sa.canceled, 'NULL') ORDER BY sa.user_id SEPARATOR "\\n") AS sa_canceled, GROUP_CONCAT(sa.user_id ORDER BY sa.user_id SEPARATOR "\\n") AS sau_id, GROUP_CONCAT(sau.pseudonym ORDER BY sa.user_id SEPARATOR "\\n") AS sau_pseudonym -FROM RapsysAirBundle:Session AS s -JOIN RapsysAirBundle:Location AS l ON (l.id = s.location_id) -JOIN RapsysAirBundle:Slot AS t ON (t.id = s.slot_id) -LEFT JOIN RapsysAirBundle:Application AS a ON (a.id = s.application_id) -LEFT JOIN RapsysAirBundle:Dance AS ad ON (ad.id = a.dance_id) -LEFT JOIN RapsysAirBundle:User AS au ON (au.id = a.user_id) -LEFT JOIN RapsysAirBundle:Snippet AS p ON (p.location_id = s.location_id AND p.user_id = a.user_id AND p.locale = :locale) -LEFT JOIN RapsysAirBundle:Application AS sa ON (sa.session_id = s.id) -LEFT JOIN RapsysAirBundle:User AS sau ON (sau.id = sa.user_id) -LEFT JOIN RapsysAirBundle:Dance AS sad ON (sad.id = sa.dance_id) +FROM Rapsys\AirBundle\Entity\Session AS s +JOIN Rapsys\AirBundle\Entity\Location AS l ON (l.id = s.location_id) +JOIN Rapsys\AirBundle\Entity\Slot AS t ON (t.id = s.slot_id) +LEFT JOIN Rapsys\AirBundle\Entity\Application AS a ON (a.id = s.application_id) +LEFT JOIN Rapsys\AirBundle\Entity\Dance AS ad ON (ad.id = a.dance_id) +LEFT JOIN Rapsys\AirBundle\Entity\User AS au ON (au.id = a.user_id) +LEFT JOIN Rapsys\AirBundle\Entity\Snippet AS p ON (p.location_id = s.location_id AND p.user_id = a.user_id AND p.locale = :locale) +LEFT JOIN Rapsys\AirBundle\Entity\Application AS sa ON (sa.session_id = s.id) +LEFT JOIN Rapsys\AirBundle\Entity\User AS sau ON (sau.id = sa.user_id) +LEFT JOIN Rapsys\AirBundle\Entity\Dance AS sad ON (sad.id = sa.dance_id) WHERE s.id = :id GROUP BY s.id ORDER BY NULL @@ -440,7 +440,7 @@ SQL; //XXX: get every location between 0 and 15 km of latitude and longitude $req = <<= :synchronized SQL; @@ -1113,7 +1113,7 @@ SQL; public function findOneByLocationSlotDate(Location $location, Slot $slot, \DateTime $date): ?Session { //Return sessions return $this->getEntityManager() - ->createQuery('SELECT s FROM RapsysAirBundle:Session s WHERE (s.location = :location AND s.slot = :slot AND s.date = :date)') + ->createQuery('SELECT s FROM Rapsys\AirBundle\Entity\Session s WHERE (s.location = :location AND s.slot = :slot AND s.date = :date)') ->setParameter('location', $location) ->setParameter('slot', $slot) ->setParameter('date', $date) @@ -1164,12 +1164,12 @@ SELECT p.donate AS p_donate, p.link AS p_link, p.profile AS p_profile -FROM RapsysAirBundle:Session AS s -JOIN RapsysAirBundle:Location AS l ON (l.id = s.location_id) -JOIN RapsysAirBundle:Application AS a ON (a.id = s.application_id) -JOIN RapsysAirBundle:Dance AS ad ON (ad.id = a.dance_id) -JOIN RapsysAirBundle:User AS au ON (au.id = a.user_id) -LEFT JOIN RapsysAirBundle:Snippet AS p ON (p.location_id = s.location_id AND p.user_id = a.user_id AND p.locale = :locale) +FROM Rapsys\AirBundle\Entity\Session AS s +JOIN Rapsys\AirBundle\Entity\Location AS l ON (l.id = s.location_id) +JOIN Rapsys\AirBundle\Entity\Application AS a ON (a.id = s.application_id) +JOIN Rapsys\AirBundle\Entity\Dance AS ad ON (ad.id = a.dance_id) +JOIN Rapsys\AirBundle\Entity\User AS au ON (au.id = a.user_id) +LEFT JOIN Rapsys\AirBundle\Entity\Snippet AS p ON (p.location_id = s.location_id AND p.user_id = a.user_id AND p.locale = :locale) WHERE s.date BETWEEN :begin AND :end ORDER BY NULL SQL; @@ -1239,8 +1239,8 @@ SQL; //XXX: select session starting after now and stopping before date(now)+3d as accuweather only provide hourly data for the next 3 days (INTERVAL 3 DAY) $req = <<= NOW() AND ADDDATE(ADDTIME(ADDTIME(s.date, s.begin), s.length), INTERVAL IF(s.slot_id = :afterid, 1, 0) DAY) < DATE(ADDDATE(NOW(), INTERVAL :accuhourly DAY)) SQL; @@ -1252,7 +1252,7 @@ SQL; //Declare all fields $rsm - ->addEntityResult('RapsysAirBundle:Session', 's') + ->addEntityResult('Rapsys\AirBundle\Entity\Session', 's') ->addFieldResult('s', 'id', 'id') ->addFieldResult('s', 'date', 'date') ->addFieldResult('s', 'begin', 'begin') @@ -1265,9 +1265,9 @@ SQL; ->addFieldResult('s', 'temperature', 'temperature') ->addFieldResult('s', 'temperaturemin', 'temperaturemin') ->addFieldResult('s', 'temperaturemax', 'temperaturemax') - ->addJoinedEntityResult('RapsysAirBundle:Slot', 'o', 's', 'slot') + ->addJoinedEntityResult('Rapsys\AirBundle\Entity\Slot', 'o', 's', 'slot') ->addFieldResult('o', 'slot_id', 'id') - ->addJoinedEntityResult('RapsysAirBundle:Location', 'l', 's', 'location') + ->addJoinedEntityResult('Rapsys\AirBundle\Entity\Location', 'l', 's', 'location') ->addFieldResult('l', 'location_id', 'id') ->addFieldResult('l', 'zipcode', 'zipcode') ->addIndexBy('s', 'id'); @@ -1288,8 +1288,8 @@ SQL; //XXX: select session stopping after or equal date(now)+3d as accuweather only provide hourly data for the next 3 days (INTERVAL 3 DAY) $req = <<= DATE(ADDDATE(NOW(), INTERVAL :accuhourly DAY)) AND ADDDATE(ADDTIME(ADDTIME(s.date, s.begin), s.length), INTERVAL IF(s.slot_id = :afterid, 1, 0) DAY) < DATE(ADDDATE(NOW(), INTERVAL :accudaily DAY)) SQL; @@ -1301,7 +1301,7 @@ SQL; //Declare all fields $rsm - ->addEntityResult('RapsysAirBundle:Session', 's') + ->addEntityResult('Rapsys\AirBundle\Entity\Session', 's') ->addFieldResult('s', 'id', 'id') ->addFieldResult('s', 'date', 'date') ->addFieldResult('s', 'begin', 'begin') @@ -1314,9 +1314,9 @@ SQL; ->addFieldResult('s', 'temperature', 'temperature') ->addFieldResult('s', 'temperaturemin', 'temperaturemin') ->addFieldResult('s', 'temperaturemax', 'temperaturemax') - ->addJoinedEntityResult('RapsysAirBundle:Slot', 'o', 's', 'slot') + ->addJoinedEntityResult('Rapsys\AirBundle\Entity\Slot', 'o', 's', 'slot') ->addFieldResult('o', 'slot_id', 'id') - ->addJoinedEntityResult('RapsysAirBundle:Location', 'l', 's', 'location') + ->addJoinedEntityResult('Rapsys\AirBundle\Entity\Location', 'l', 's', 'location') ->addFieldResult('l', 'location_id', 'id') ->addFieldResult('l', 'zipcode', 'zipcode') ->addIndexBy('s', 'id'); @@ -1338,9 +1338,9 @@ SQL; //TODO: remonter les données pour le mail ? $req =<<addEntityResult('RapsysAirBundle:Session', 's') + ->addEntityResult('Rapsys\AirBundle\Entity\Session', 's') ->addFieldResult('s', 'id', 'id') ->addIndexBy('s', 'id'); @@ -1462,29 +1462,29 @@ FROM ( s.premium, l.hotspot, a.created - FROM RapsysAirBundle:Session AS s - JOIN RapsysAirBundle:Location AS l ON (l.id = s.location_id) - JOIN RapsysAirBundle:Application AS a ON (a.session_id = s.id AND a.canceled IS NULL) - LEFT JOIN RapsysAirBundle:Session AS s2 ON (s2.id != s.id AND s2.location_id = s.location_id AND s2.slot_id IN (:afternoonid, :eveningid) AND s2.application_id IS NOT NULL AND s2.locked IS NULL AND s2.date > s.date - INTERVAL 1 YEAR) - LEFT JOIN RapsysAirBundle:Application AS a2 ON (a2.id = s2.application_id AND a2.user_id = a.user_id AND (a2.canceled IS NULL OR TIMESTAMPDIFF(DAY, a2.canceled, ADDDATE(ADDTIME(s2.date, s2.begin), INTERVAL IF(s2.slot_id = :afterid, 1, 0) DAY)) < 1)) + FROM Rapsys\AirBundle\Entity\Session AS s + JOIN Rapsys\AirBundle\Entity\Location AS l ON (l.id = s.location_id) + JOIN Rapsys\AirBundle\Entity\Application AS a ON (a.session_id = s.id AND a.canceled IS NULL) + LEFT JOIN Rapsys\AirBundle\Entity\Session AS s2 ON (s2.id != s.id AND s2.location_id = s.location_id AND s2.slot_id IN (:afternoonid, :eveningid) AND s2.application_id IS NOT NULL AND s2.locked IS NULL AND s2.date > s.date - INTERVAL 1 YEAR) + LEFT JOIN Rapsys\AirBundle\Entity\Application AS a2 ON (a2.id = s2.application_id AND a2.user_id = a.user_id AND (a2.canceled IS NULL OR TIMESTAMPDIFF(DAY, a2.canceled, ADDDATE(ADDTIME(s2.date, s2.begin), INTERVAL IF(s2.slot_id = :afterid, 1, 0) DAY)) < 1)) WHERE s.id = :sid GROUP BY a.id ORDER BY NULL LIMIT 0, :limit ) AS b - LEFT JOIN RapsysAirBundle:Session AS s3 ON (s3.id != b.session_id AND s3.application_id IS NOT NULL AND s3.locked IS NULL AND s3.date > b.date - INTERVAL 1 YEAR) - LEFT JOIN RapsysAirBundle:Application AS a3 ON (a3.id = s3.application_id AND a3.user_id = b.user_id AND (a3.canceled IS NULL OR TIMESTAMPDIFF(DAY, a3.canceled, ADDDATE(ADDTIME(s3.date, s3.begin), INTERVAL IF(s3.slot_id = :afterid, 1, 0) DAY)) < 1)) + LEFT JOIN Rapsys\AirBundle\Entity\Session AS s3 ON (s3.id != b.session_id AND s3.application_id IS NOT NULL AND s3.locked IS NULL AND s3.date > b.date - INTERVAL 1 YEAR) + LEFT JOIN Rapsys\AirBundle\Entity\Application AS a3 ON (a3.id = s3.application_id AND a3.user_id = b.user_id AND (a3.canceled IS NULL OR TIMESTAMPDIFF(DAY, a3.canceled, ADDDATE(ADDTIME(s3.date, s3.begin), INTERVAL IF(s3.slot_id = :afterid, 1, 0) DAY)) < 1)) GROUP BY b.id ORDER BY NULL LIMIT 0, :limit ) AS c - LEFT JOIN RapsysAirBundle:Session AS s4 ON (s4.id != c.session_id AND s4.location_id = c.location_id AND s4.application_id IS NOT NULL AND s4.locked IS NULL AND s4.date > c.date - INTERVAL 1 YEAR) - LEFT JOIN RapsysAirBundle:Application AS a4 ON (a4.id = s4.application_id AND a4.user_id != c.user_id AND (a4.canceled IS NULL OR TIMESTAMPDIFF(DAY, a4.canceled, ADDDATE(ADDTIME(s4.date, s4.begin), INTERVAL IF(s4.slot_id = :afterid, 1, 0) DAY)) < 1)) + LEFT JOIN Rapsys\AirBundle\Entity\Session AS s4 ON (s4.id != c.session_id AND s4.location_id = c.location_id AND s4.application_id IS NOT NULL AND s4.locked IS NULL AND s4.date > c.date - INTERVAL 1 YEAR) + LEFT JOIN Rapsys\AirBundle\Entity\Application AS a4 ON (a4.id = s4.application_id AND a4.user_id != c.user_id AND (a4.canceled IS NULL OR TIMESTAMPDIFF(DAY, a4.canceled, ADDDATE(ADDTIME(s4.date, s4.begin), INTERVAL IF(s4.slot_id = :afterid, 1, 0) DAY)) < 1)) GROUP BY c.id ORDER BY NULL LIMIT 0, :limit ) AS d - LEFT JOIN RapsysAirBundle:UserGroup AS ug ON (ug.user_id = d.user_id) + LEFT JOIN Rapsys\AirBundle\Entity\UserGroup AS ug ON (ug.user_id = d.user_id) GROUP BY d.id LIMIT 0, :limit ) AS e @@ -1501,7 +1501,7 @@ SQL; $req = str_replace($this->tableKeys, $this->tableValues, $req); //Set update request - $upreq = 'UPDATE RapsysAirBundle:Application SET score = :score, updated = NOW() WHERE id = :id'; + $upreq = 'UPDATE Rapsys\AirBundle\Entity\Application SET score = :score, updated = NOW() WHERE id = :id'; //Replace bundle entity name by table name $upreq = str_replace($this->tableKeys, $this->tableValues, $upreq); @@ -1511,7 +1511,7 @@ SQL; //Declare all fields $rsm - ->addEntityResult('RapsysAirBundle:Application', 'a') + ->addEntityResult('Rapsys\AirBundle\Entity\Application', 'a') ->addFieldResult('a', 'id', 'id') ->addFieldResult('a', 'score', 'score') ->addIndexBy('a', 'id'); @@ -1564,8 +1564,8 @@ FROM ( s.begin, s.slot_id, GROUP_CONCAT(sa.id ORDER BY sa.id SEPARATOR "\\n") AS sa_id - FROM RapsysAirBundle:Session AS s - LEFT JOIN RapsysAirBundle:Application AS sa ON (sa.session_id = s.id) + FROM Rapsys\AirBundle\Entity\Session AS s + LEFT JOIN Rapsys\AirBundle\Entity\Application AS sa ON (sa.session_id = s.id) GROUP BY s.id ORDER BY NULL ) AS a @@ -1597,7 +1597,7 @@ SQL; //Set update session request $sreq = <<tableKeys, $this->tableValues, $req); diff --git a/Repository/SnippetRepository.php b/Repository/SnippetRepository.php index 2da863e..3d53487 100644 --- a/Repository/SnippetRepository.php +++ b/Repository/SnippetRepository.php @@ -25,7 +25,7 @@ class SnippetRepository extends \Doctrine\ORM\EntityRepository { public function findByUserIdLocaleIndexByLocationId(int $userId, string $locale): array { //Fetch snippets $ret = $this->_em - ->createQuery('SELECT s FROM RapsysAirBundle:Snippet s INDEX BY s.location WHERE s.locale = :locale and s.user = :user') + ->createQuery('SELECT s FROM Rapsys\AirBundle\Entity\Snippet s INDEX BY s.location WHERE s.locale = :locale and s.user = :user') ->setParameter('user', $userId) ->setParameter('locale', $locale) ->getResult(); diff --git a/Repository/UserRepository.php b/Repository/UserRepository.php index 9b34057..3918551 100644 --- a/Repository/UserRepository.php +++ b/Repository/UserRepository.php @@ -41,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 @@ -116,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 @@ -156,8 +156,8 @@ SQL; //Set the request $req =<< $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]); @@ -402,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