X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=92d1867bf7532e924185b54862b6710d86330249;hb=8d2527ec528d1631be21967137f63d2fc0cf218f;hp=bfd079377ac783bdd4c2e0e2f84cb3f2e9d0496b;hpb=d50c93f05585485157668888afa3660f88f3a572;p=github%2Fwallabag%2Fwallabag.git 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 * * @return QueryBuilder */ - public function getBuilderForAllByUser($userId) + public function getBuilderForAllByUser($userId, $sortBy = 'id', $direction = 'DESC') { return $this - ->getSortedQueryBuilderByUser($userId) + ->getSortedQueryBuilderByUser($userId, $sortBy, $direction) ; } @@ -34,11 +34,12 @@ class EntryRepository extends EntityRepository * * @return QueryBuilder */ - public function getBuilderForUnreadByUser($userId) + public function getBuilderForUnreadByUser($userId, $sortBy = 'id', $direction = 'DESC') { return $this ->getSortedQueryBuilderByUser($userId) ->andWhere('e.isArchived = false') + ->orderBy('e.'.$sortBy, $direction) ; } @@ -49,11 +50,12 @@ class EntryRepository extends EntityRepository * * @return QueryBuilder */ - public function getBuilderForArchiveByUser($userId) + public function getBuilderForArchiveByUser($userId, $sortBy = 'id', $direction = 'DESC') { return $this ->getSortedQueryBuilderByUser($userId, 'archivedAt', 'desc') ->andWhere('e.isArchived = true') + ->orderBy('e.'.$sortBy, $direction) ; } @@ -64,11 +66,12 @@ class EntryRepository extends EntityRepository * * @return QueryBuilder */ - public function getBuilderForStarredByUser($userId) + public function getBuilderForStarredByUser($userId, $sortBy = 'id', $direction = 'DESC') { return $this ->getSortedQueryBuilderByUser($userId, 'starredAt', 'desc') ->andWhere('e.isStarred = true') + ->orderBy('e.'.$sortBy, $direction) ; }