]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/TagRepository.php
Merge remote-tracking branch 'origin/v2' into v2_fix_material
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / TagRepository.php
index 0f362f79ebb0efdc37d4a9f2599e4100e24723e6..51f1cd42924b22a88eb879fd6b5b3b14cfff058f 100644 (file)
@@ -3,21 +3,25 @@
 namespace Wallabag\CoreBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Pagerfanta\Adapter\DoctrineORMAdapter;
+use Pagerfanta\Pagerfanta;
 
 class TagRepository extends EntityRepository
 {
-    public function findByEntries($entryId)
+    /**
+     * Find Tags.
+     *
+     * @param int    $userId
+     *
+     * @return array
+     */
+    public function findTags($userId)
     {
         $qb = $this->createQueryBuilder('t')
-            ->select('t')
-            ->leftJoin('t.id', 'u')
-            ->where('e.isStarred = true')
-            ->andWhere('u.id =:userId')->setParameter('userId', $userId)
-            ->orderBy('e.createdAt', 'desc')
-            ->getQuery();
+            ->where('t.user =:userId')->setParameter('userId', $userId);
 
-        $paginator = new Paginator($qb);
+        $pagerAdapter = new DoctrineORMAdapter($qb);
 
-        return $paginator;
+        return new Pagerfanta($pagerAdapter);
     }
 }