3 namespace Wallabag\CoreBundle\Repository
;
5 use Doctrine\ORM\Query
;
6 use Doctrine\ORM\EntityRepository
;
7 use Doctrine\ORM\Tools\Pagination\Paginator
;
9 class EntriesRepository
extends EntityRepository
12 * Retrieves unread entries for a user
16 * @param int $maxResults
19 public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
21 $qb = $this->createQueryBuilder('e')
23 ->setFirstResult($firstResult)
24 ->setMaxResults($maxResults)
25 ->where('e.isRead = 0')
26 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
29 $paginator = new Paginator($qb);
35 * Retrieves read entries for a user
39 * @param int $maxResults
42 public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
44 $qb = $this->createQueryBuilder('e')
46 ->setFirstResult($firstResult)
47 ->setMaxResults($maxResults)
48 ->where('e.isRead = 1')
49 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
52 $paginator = new Paginator($qb);
58 * Retrieves starred entries for a user
62 * @param int $maxResults
65 public function findStarredByUser($userId, $firstResult, $maxResults = 12)
67 $qb = $this->createQueryBuilder('e')
69 ->setFirstResult($firstResult)
70 ->setMaxResults($maxResults)
71 ->where('e.isFav = 1')
72 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
75 $paginator = new Paginator($qb);