3 namespace Wallabag\CoreBundle\Repository
;
5 use Doctrine\ORM\EntityRepository
;
6 use Pagerfanta\Adapter\DoctrineORMAdapter
;
7 use Pagerfanta\Pagerfanta
;
9 class TagRepository
extends EntityRepository
12 * Return only the QueryBuilder to retrieve all tags for a given user.
16 * @return QueryBuilder
18 private function getQbForAllTags($userId)
20 return $this->createQueryBuilder('t')
21 ->leftJoin('t.entries', 'e')
22 ->where('e.user = :userId')->setParameter('userId', $userId);
26 * Find Tags and return a Pager.
32 public function findTags($userId)
34 $qb = $this->getQbForAllTags($userId);
36 $pagerAdapter = new DoctrineORMAdapter($qb);
38 return new Pagerfanta($pagerAdapter);
48 public function findAllTags($userId)
50 return $this->getQbForAllTags($userId)