]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/AnnotationBundle/Repository/AnnotationRepository.php
AnnotationRepository: rename getBuilderByUser
[github/wallabag/wallabag.git] / src / Wallabag / AnnotationBundle / Repository / AnnotationRepository.php
index da3613089ced7a19d5e6b74961dc251c39a233b1..0de5c934e8d53f25df111d329f829446bf8e02cb 100644 (file)
@@ -3,28 +3,14 @@
 namespace Wallabag\AnnotationBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Doctrine\ORM\QueryBuilder;
+use Wallabag\AnnotationBundle\Entity\Annotation;
 
 /**
  * AnnotationRepository.
  */
 class AnnotationRepository extends EntityRepository
 {
-    /**
-     * Return a query builder to used by other getBuilderFor* method.
-     *
-     * @param int $userId
-     *
-     * @return QueryBuilder
-     */
-    private function getBuilderByUser($userId)
-    {
-        return $this->createQueryBuilder('a')
-            ->leftJoin('a.user', 'u')
-            ->andWhere('u.id = :userId')->setParameter('userId', $userId)
-            ->orderBy('a.id', 'desc')
-        ;
-    }
-
     /**
      * Retrieves all annotations for a user.
      *
@@ -35,7 +21,7 @@ class AnnotationRepository extends EntityRepository
     public function getBuilderForAllByUser($userId)
     {
         return $this
-            ->getBuilderByUser($userId)
+            ->getSortedQueryBuilderByUser($userId)
         ;
     }
 
@@ -139,4 +125,20 @@ class AnnotationRepository extends EntityRepository
             ->getQuery()
             ->getResult();
     }
+
+    /**
+     * Return a query builder to used by other getBuilderFor* method.
+     *
+     * @param int $userId
+     *
+     * @return QueryBuilder
+     */
+    private function getSortedQueryBuilderByUser($userId)
+    {
+        return $this->createQueryBuilder('a')
+            ->leftJoin('a.user', 'u')
+            ->andWhere('u.id = :userId')->setParameter('userId', $userId)
+            ->orderBy('a.id', 'desc')
+        ;
+    }
 }