]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/TagRepository.php
Add tags list display
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Repository / TagRepository.php
index 52f319f11158f69315b30650d5ba9ce0782f8fc8..51f1cd42924b22a88eb879fd6b5b3b14cfff058f 100644 (file)
@@ -3,7 +3,25 @@
 namespace Wallabag\CoreBundle\Repository;
 
 use Doctrine\ORM\EntityRepository;
+use Pagerfanta\Adapter\DoctrineORMAdapter;
+use Pagerfanta\Pagerfanta;
 
 class TagRepository extends EntityRepository
 {
+    /**
+     * Find Tags.
+     *
+     * @param int    $userId
+     *
+     * @return array
+     */
+    public function findTags($userId)
+    {
+        $qb = $this->createQueryBuilder('t')
+            ->where('t.user =:userId')->setParameter('userId', $userId);
+
+        $pagerAdapter = new DoctrineORMAdapter($qb);
+
+        return new Pagerfanta($pagerAdapter);
+    }
 }