]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/TagRepository.php
CS
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / TagRepository.php
index 0f362f79ebb0efdc37d4a9f2599e4100e24723e6..9c4096072626273dd98372a69f95f85a07c61262 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);
     }
 }