]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Repository/UserRepository.php
Version 0.6.0
[airbundle] / Repository / UserRepository.php
index 4e7dae86cd8c3043418ac2972a89bf4980639c20..403e8ab1075c0909c1df89009a7101043b820aa2 100644 (file)
@@ -69,7 +69,7 @@ SQL;
                        ->addIndexByScalar('id');
 
                //Fetch result
-               $res = $this->_em
+               $res = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getResult();
 
@@ -139,7 +139,7 @@ SQL;
                $rsm->addScalarResult('id', 'id', 'integer');
 
                //Return result
-               return $this->_em
+               return $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('pseudonym', $pseudonym)
                        //XXX: instead of array_column on the result
@@ -175,7 +175,7 @@ SQL;
                        ->addIndexByScalar('pseudonym');
 
                //Get result
-               $result = $this->_em
+               $result = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $sessionId)
                        ->getArrayResult();
@@ -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)
@@ -246,21 +246,21 @@ SQL;
                        ->addScalarResult('phone', 'phone', 'string')
                        ->addScalarResult('pseudonym', 'pseudonym', 'string')
                        ->addScalarResult('surname', 'surname', 'string')
-                       ->addScalarResult('updated', 'updated', 'datetime')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
                        ->addScalarResult('zipcode', 'zipcode', 'string')
                        ->addScalarResult('c_id', 'c_id', 'integer')
                        ->addScalarResult('c_title', 'c_title', 'string')
                        ->addScalarResult('o_id', 'o_id', 'integer')
                        ->addScalarResult('o_title', 'o_title', 'string')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        //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
-               $result = $this->_em
+               $result = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $id)
                        ->getOneOrNullResult();
@@ -444,7 +444,7 @@ SQL;
                        ->addScalarResult('d_types', 'd_types', 'string');
 
                //Fetch result
-               $res = $this->_em
+               $res = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getResult();