3 namespace WallabagBundle\Repository
;
5 use Doctrine\ORM\Query
;
6 use Doctrine\ORM\EntityRepository
;
7 use Doctrine\ORM\Tools\Pagination\Paginator
;
9 class EntriesRepository
extends EntityRepository
11 public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
13 $qb = $this->createQueryBuilder('e')
15 ->setFirstResult($firstResult)
16 ->setMaxResults($maxResults)
17 ->where('e.isRead = 0')
18 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
21 $pag = new Paginator($qb);
26 public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
28 $qb = $this->createQueryBuilder('e')
30 ->setFirstResult($firstResult)
31 ->setMaxResults($maxResults)
32 ->where('e.isRead = 1')
33 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
35 ->getResult(Query
::HYDRATE_ARRAY
);
40 public function findStarredByUser($userId, $firstResult, $maxResults = 12)
42 $qb = $this->createQueryBuilder('e')
44 ->setFirstResult($firstResult)
45 ->setMaxResults($maxResults)
46 ->where('e.isFav = 1')
47 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
49 ->getResult(Query
::HYDRATE_ARRAY
);