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);
}
}