aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/WallabagBundle/Repository
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 12:45:24 +0100
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-01-23 12:45:24 +0100
commit163eae0bb15d0daa5390f434a42a8176eca186e7 (patch)
tree0e1ab2c2bb9591e826e73d875cbb04fdabb3f77f /src/WallabagBundle/Repository
parentbd9f08157cc10619e9bb9dace6df43090dde44a9 (diff)
downloadwallabag-163eae0bb15d0daa5390f434a42a8176eca186e7.tar.gz
wallabag-163eae0bb15d0daa5390f434a42a8176eca186e7.tar.zst
wallabag-163eae0bb15d0daa5390f434a42a8176eca186e7.zip
toggle archive / fav actions
Diffstat (limited to 'src/WallabagBundle/Repository')
-rw-r--r--src/WallabagBundle/Repository/EntriesRepository.php26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/WallabagBundle/Repository/EntriesRepository.php b/src/WallabagBundle/Repository/EntriesRepository.php
index c355a012..c4428a1d 100644
--- a/src/WallabagBundle/Repository/EntriesRepository.php
+++ b/src/WallabagBundle/Repository/EntriesRepository.php
@@ -4,31 +4,31 @@ namespace WallabagBundle\Repository;
4 4
5use Doctrine\ORM\Query; 5use Doctrine\ORM\Query;
6use Doctrine\ORM\EntityRepository; 6use Doctrine\ORM\EntityRepository;
7use Doctrine\ORM\Tools\Pagination\Paginator;
7 8
8/**
9 * EntriesRepository
10 *
11 * This class was generated by the Doctrine ORM. Add your own custom
12 * repository methods below.
13 */
14class EntriesRepository extends EntityRepository 9class EntriesRepository extends EntityRepository
15{ 10{
16 public function findUnreadByUser($userId) 11 public function findUnreadByUser($userId, $firstResult, $maxResults = 12)
17 { 12 {
18 $qb = $this->createQueryBuilder('e') 13 $qb = $this->createQueryBuilder('e')
19 ->select('e') 14 ->select('e')
15 ->setFirstResult($firstResult)
16 ->setMaxResults($maxResults)
20 ->where('e.isRead = 0') 17 ->where('e.isRead = 0')
21 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 18 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
22 ->getQuery() 19 ->getQuery();
23 ->getResult(Query::HYDRATE_ARRAY);
24 20
25 return $qb; 21 $pag = new Paginator($qb);
22
23 return $pag;
26 } 24 }
27 25
28 public function findArchiveByUser($userId) 26 public function findArchiveByUser($userId, $firstResult, $maxResults = 12)
29 { 27 {
30 $qb = $this->createQueryBuilder('e') 28 $qb = $this->createQueryBuilder('e')
31 ->select('e') 29 ->select('e')
30 ->setFirstResult($firstResult)
31 ->setMaxResults($maxResults)
32 ->where('e.isRead = 1') 32 ->where('e.isRead = 1')
33 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 33 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
34 ->getQuery() 34 ->getQuery()
@@ -37,10 +37,12 @@ class EntriesRepository extends EntityRepository
37 return $qb; 37 return $qb;
38 } 38 }
39 39
40 public function findStarredByUser($userId) 40 public function findStarredByUser($userId, $firstResult, $maxResults = 12)
41 { 41 {
42 $qb = $this->createQueryBuilder('e') 42 $qb = $this->createQueryBuilder('e')
43 ->select('e') 43 ->select('e')
44 ->setFirstResult($firstResult)
45 ->setMaxResults($maxResults)
44 ->where('e.isFav = 1') 46 ->where('e.isFav = 1')
45 ->andWhere('e.userId =:userId')->setParameter('userId', $userId) 47 ->andWhere('e.userId =:userId')->setParameter('userId', $userId)
46 ->getQuery() 48 ->getQuery()