aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/TagRepository.php
blob: 9c4096072626273dd98372a69f95f85a07c61262 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php

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