aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index bfd07937..92d1867b 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -20,10 +20,10 @@ class EntryRepository extends EntityRepository
20 * 20 *
21 * @return QueryBuilder 21 * @return QueryBuilder
22 */ 22 */
23 public function getBuilderForAllByUser($userId) 23 public function getBuilderForAllByUser($userId, $sortBy = 'id', $direction = 'DESC')
24 { 24 {
25 return $this 25 return $this
26 ->getSortedQueryBuilderByUser($userId) 26 ->getSortedQueryBuilderByUser($userId, $sortBy, $direction)
27 ; 27 ;
28 } 28 }
29 29
@@ -34,11 +34,12 @@ class EntryRepository extends EntityRepository
34 * 34 *
35 * @return QueryBuilder 35 * @return QueryBuilder
36 */ 36 */
37 public function getBuilderForUnreadByUser($userId) 37 public function getBuilderForUnreadByUser($userId, $sortBy = 'id', $direction = 'DESC')
38 { 38 {
39 return $this 39 return $this
40 ->getSortedQueryBuilderByUser($userId) 40 ->getSortedQueryBuilderByUser($userId)
41 ->andWhere('e.isArchived = false') 41 ->andWhere('e.isArchived = false')
42 ->orderBy('e.'.$sortBy, $direction)
42 ; 43 ;
43 } 44 }
44 45
@@ -49,11 +50,12 @@ class EntryRepository extends EntityRepository
49 * 50 *
50 * @return QueryBuilder 51 * @return QueryBuilder
51 */ 52 */
52 public function getBuilderForArchiveByUser($userId) 53 public function getBuilderForArchiveByUser($userId, $sortBy = 'id', $direction = 'DESC')
53 { 54 {
54 return $this 55 return $this
55 ->getSortedQueryBuilderByUser($userId, 'archivedAt', 'desc') 56 ->getSortedQueryBuilderByUser($userId, 'archivedAt', 'desc')
56 ->andWhere('e.isArchived = true') 57 ->andWhere('e.isArchived = true')
58 ->orderBy('e.'.$sortBy, $direction)
57 ; 59 ;
58 } 60 }
59 61
@@ -64,11 +66,12 @@ class EntryRepository extends EntityRepository
64 * 66 *
65 * @return QueryBuilder 67 * @return QueryBuilder
66 */ 68 */
67 public function getBuilderForStarredByUser($userId) 69 public function getBuilderForStarredByUser($userId, $sortBy = 'id', $direction = 'DESC')
68 { 70 {
69 return $this 71 return $this
70 ->getSortedQueryBuilderByUser($userId, 'starredAt', 'desc') 72 ->getSortedQueryBuilderByUser($userId, 'starredAt', 'desc')
71 ->andWhere('e.isStarred = true') 73 ->andWhere('e.isStarred = true')
74 ->orderBy('e.'.$sortBy, $direction)
72 ; 75 ;
73 } 76 }
74 77