aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-07 22:20:30 +0200
committerNicolas LÅ“uillet <nicolas@loeuillet.org>2015-08-12 09:01:29 +0200
commit2686457448372543fdf4f1fc54c4fd20f0f02c2c (patch)
tree485eeecc3bd3db3613d47de25662d5c9163e4afe /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parentfedaf005377e6d62ff0986f7f54afef3287a6451 (diff)
downloadwallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.tar.gz
wallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.tar.zst
wallabag-2686457448372543fdf4f1fc54c4fd20f0f02c2c.zip
store estimated reading time / filters on reading time
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php36
1 files changed, 9 insertions, 27 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index a4514d9e..f885ee94 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -13,20 +13,15 @@ class EntryRepository extends EntityRepository
13 * 13 *
14 * @param int $userId 14 * @param int $userId
15 * 15 *
16 * @return Pagerfanta 16 * @return QueryBuilder
17 */ 17 */
18 public function findUnreadByUser($userId) 18 public function findUnreadByUser($userId)
19 { 19 {
20 $qb = $this->createQueryBuilder('e') 20 return $this->createQueryBuilder('e')
21 ->leftJoin('e.user', 'u') 21 ->leftJoin('e.user', 'u')
22 ->where('e.isArchived = false') 22 ->where('e.isArchived = false')
23 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 23 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
24 ->orderBy('e.id', 'desc') 24 ->orderBy('e.id', 'desc');
25 ->getQuery();
26
27 $pagerAdapter = new DoctrineORMAdapter($qb);
28
29 return new Pagerfanta($pagerAdapter);
30 } 25 }
31 26
32 /** 27 /**
@@ -34,21 +29,15 @@ class EntryRepository extends EntityRepository
34 * 29 *
35 * @param int $userId 30 * @param int $userId
36 * 31 *
37 * @return Pagerfanta 32 * @return QueryBuilder
38 */ 33 */
39 public function findArchiveByUser($userId) 34 public function findArchiveByUser($userId)
40 { 35 {
41 $qb = $this->createQueryBuilder('e') 36 return $this->createQueryBuilder('e')
42 ->select('e')
43 ->leftJoin('e.user', 'u') 37 ->leftJoin('e.user', 'u')
44 ->where('e.isArchived = true') 38 ->where('e.isArchived = true')
45 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 39 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
46 ->orderBy('e.id', 'desc') 40 ->orderBy('e.id', 'desc');
47 ->getQuery();
48
49 $pagerAdapter = new DoctrineORMAdapter($qb);
50
51 return new Pagerfanta($pagerAdapter);
52 } 41 }
53 42
54 /** 43 /**
@@ -56,22 +45,15 @@ class EntryRepository extends EntityRepository
56 * 45 *
57 * @param int $userId 46 * @param int $userId
58 * 47 *
59 * @return Pagerfanta 48 * @return QueryBuilder
60 */ 49 */
61 public function findStarredByUser($userId) 50 public function findStarredByUser($userId)
62 { 51 {
63 52 return $this->createQueryBuilder('e')
64 $qb = $this->createQueryBuilder('e')
65 ->select('e')
66 ->leftJoin('e.user', 'u') 53 ->leftJoin('e.user', 'u')
67 ->where('e.isStarred = true') 54 ->where('e.isStarred = true')
68 ->andWhere('u.id =:userId')->setParameter('userId', $userId) 55 ->andWhere('u.id =:userId')->setParameter('userId', $userId)
69 ->orderBy('e.id', 'desc') 56 ->orderBy('e.id', 'desc');
70 ->getQuery();
71
72 $pagerAdapter = new DoctrineORMAdapter($qb);
73
74 return new Pagerfanta($pagerAdapter);
75 } 57 }
76 58
77 /** 59 /**