]> Raphaƫl G. Git Repositories - blogbundle/blobdiff - Repository/ArticleRepository.php
Replace EntityRepository by Repository class
[blogbundle] / Repository / ArticleRepository.php
index 9708751067d9b5005e80b699ec3366cfb5b46278..a8ec9dfce35dfe078e4c3da6575c204a7d583d28 100644 (file)
@@ -13,13 +13,15 @@ namespace Rapsys\BlogBundle\Repository;
 
 use Doctrine\ORM\Query\ResultSetMapping;
 
+use Rapsys\BlogBundle\Repository;
+
 /**
  * ArticleRepository
  *
  * This class was generated by the Doctrine ORM. Add your own custom
  * repository methods below.
  */
-class ArticleRepository extends EntityRepository {
+class ArticleRepository extends Repository {
        /**
         * Find article count as int
         *
@@ -46,7 +48,7 @@ SQL;
                $rsm->addScalarResult('count', 'count', 'integer');
 
                //Get result
-               return $this->_em
+               return $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->getSingleScalarResult();
        }
@@ -101,13 +103,13 @@ SQL;
                        ->addScalarResult('k_ids', 'k_ids', 'string')
                        ->addScalarResult('k_slugs', 'k_slugs', 'string')
                        ->addScalarResult('k_titles', 'k_titles', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime')
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable')
                        ->addIndexByScalar('id');
 
                //Get result
-               $result = $this->_em
+               $result = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('offset', $page * $count)
                        ->setParameter('count', $count)
@@ -226,12 +228,12 @@ SQL;
                        ->addScalarResult('kat_locales', 'kat_locales', 'string')
                        ->addScalarResult('kat_slugs', 'kat_slugs', 'string')
                        ->addScalarResult('kat_titles', 'kat_titles', 'string')
-                       ->addScalarResult('created', 'created', 'datetime')
-                       ->addScalarResult('updated', 'updated', 'datetime')
-                       ->addScalarResult('modified', 'modified', 'datetime');
+                       ->addScalarResult('created', 'created', 'datetime_immutable')
+                       ->addScalarResult('updated', 'updated', 'datetime_immutable')
+                       ->addScalarResult('modified', 'modified', 'datetime_immutable');
 
                //Get data
-               $data = $this->_em
+               $data = $this->manager
                        ->createNativeQuery($req, $rsm)
                        ->setParameter('id', $id)
                        ->getOneOrNullResult();