]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Repository/DanceRepository.php
Use RAPSYSAIR_GOOGLE_PROJECT, RAPSYSAIR_GOOGLE_CLIENT and RAPSYSAIR_GOOGLE_SECRET...
[airbundle] / Repository / DanceRepository.php
index e7dd4753dd717e5922921d1c08e0560b87faeb96..251a1baa21913829941c783703a620248b93ab5b 100644 (file)
@@ -14,6 +14,8 @@ namespace Rapsys\AirBundle\Repository;
 use Doctrine\ORM\AbstractQuery;
 use Doctrine\ORM\Query\ResultSetMapping;
 
 use Doctrine\ORM\AbstractQuery;
 use Doctrine\ORM\Query\ResultSetMapping;
 
+use Rapsys\AirBundle\Repository;
+
 /**
  * DanceRepository
  */
 /**
  * DanceRepository
  */
@@ -30,7 +32,7 @@ SELECT
        d.id,
        d.name,
        d.type
        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
 SQL;
 
                //Replace bundle entity name by table name
@@ -43,7 +45,7 @@ SQL;
                //Declare all fields
                //XXX: see vendor/doctrine/dbal/lib/Doctrine/DBAL/Types/Types.php
                //addScalarResult($sqlColName, $resColName, $type = 'string');
                //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')
                        ->addFieldResult('d', 'id', 'id')
                        ->addFieldResult('d', 'name', 'name')
                        ->addFieldResult('d', 'type', 'type')
@@ -67,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
        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;
 GROUP BY d.name
 ORDER BY d.name
 SQL;
@@ -131,7 +133,7 @@ SQL;
                $req = <<<SQL
 SELECT
        d.id
                $req = <<<SQL
 SELECT
        d.id
-FROM RapsysAirBundle:Dance AS d
+FROM Rapsys\AirBundle\Entity\Dance AS d
 WHERE CONCAT_WS(' ', d.name, d.type) IN (:nametype)
 ORDER BY d.name, d.type
 SQL;
 WHERE CONCAT_WS(' ', d.name, d.type) IN (:nametype)
 ORDER BY d.name, d.type
 SQL;
@@ -169,7 +171,7 @@ SELECT
        GROUP_CONCAT(d.id ORDER BY d.id SEPARATOR "\\n") AS ids,
        GROUP_CONCAT(d.type ORDER BY d.id SEPARATOR "\\n") AS types,
        MAX(d.updated) AS modified
        GROUP_CONCAT(d.id ORDER BY d.id SEPARATOR "\\n") AS ids,
        GROUP_CONCAT(d.type ORDER BY d.id SEPARATOR "\\n") AS types,
        MAX(d.updated) AS modified
-FROM RapsysAirBundle:Dance AS d
+FROM Rapsys\AirBundle\Entity\Dance AS d
 GROUP BY d.name
 ORDER BY d.name
 SQL;
 GROUP BY d.name
 ORDER BY d.name
 SQL;
@@ -219,7 +221,7 @@ SQL;
                                        'id' => $id,
                                        'type' => $type = $this->translator->trans($name['types'][$k]),
                                        'slug' => $stype = $this->slugger->slug($type),
                                        'id' => $id,
                                        'type' => $type = $this->translator->trans($name['types'][$k]),
                                        'slug' => $stype = $this->slugger->slug($type),
-                                       'link' => $this->router->generate('rapsys_air_dance_view', ['id' => $id, 'name' => $slug, 'type' => $stype])
+                                       'link' => $this->router->generate('rapsysair_dance_view', ['id' => $id, 'name' => $slug, 'type' => $stype])
                                ];
                        }
 
                                ];
                        }
 
@@ -227,7 +229,7 @@ SQL;
                        $return[$sname = $this->slugger->short($name['name'])] = [
                                'name' => $tname,
                                'slug' => $slug,
                        $return[$sname = $this->slugger->short($name['name'])] = [
                                'name' => $tname,
                                'slug' => $slug,
-                               'link' => $this->router->generate('rapsys_air_dance_name', ['name' => $sname, 'dance' => $slug]),
+                               'link' => $this->router->generate('rapsysair_dance_name', ['name' => $sname, 'dance' => $slug]),
                                'types' => $types,
                                'modified' => $name['modified']
                        ];
                                'types' => $types,
                                'modified' => $name['modified']
                        ];
@@ -246,8 +248,8 @@ SQL;
        public function findByUserId($userId): array {
                //Set the request
                $req = 'SELECT d.id, d.name, d.type
        public function findByUserId($userId): array {
                //Set the request
                $req = 'SELECT d.id, d.name, d.type
-FROM RapsysAirBundle:UserDance AS ud
-JOIN RapsysAirBundle:Dance AS d ON (d.id = ud.dance_id)
+FROM Rapsys\AirBundle\Entity\UserDance AS ud
+JOIN Rapsys\AirBundle\Entity\Dance AS d ON (d.id = ud.dance_id)
 WHERE ud.user_id = :uid';
 
                //Replace bundle entity name by table name
 WHERE ud.user_id = :uid';
 
                //Replace bundle entity name by table name
@@ -258,7 +260,7 @@ WHERE ud.user_id = :uid';
                $rsm = new ResultSetMapping();
 
                //Declare result set for our request
                $rsm = new ResultSetMapping();
 
                //Declare result set for our request
-               $rsm->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');
                $rsm->addFieldResult('d', 'id', 'id');
                $rsm->addFieldResult('d', 'name', 'name');
                $rsm->addFieldResult('d', 'type', 'type');