X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FRepository%2FEntryRepository.php;h=cf1cdb8a5e0a77c8fbb349458099d90baa8a9e40;hb=96295ec84796551590d24a3516ccbba43469b6f6;hp=92d1867bf7532e924185b54862b6710d86330249;hpb=f9987d4a213627c6e09eee80743d42c344482e69;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 92d1867b..cf1cdb8a 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -16,7 +16,9 @@ class EntryRepository extends EntityRepository /** * Retrieves all entries for a user. * - * @param int $userId + * @param int $userId + * @param string $sortBy Field to sort + * @param string $direction Direction of the order * * @return QueryBuilder */ @@ -30,48 +32,51 @@ class EntryRepository extends EntityRepository /** * Retrieves unread entries for a user. * - * @param int $userId + * @param int $userId + * @param string $sortBy Field to sort + * @param string $direction Direction of the order * * @return QueryBuilder */ public function getBuilderForUnreadByUser($userId, $sortBy = 'id', $direction = 'DESC') { return $this - ->getSortedQueryBuilderByUser($userId) + ->getSortedQueryBuilderByUser($userId, $sortBy, $direction) ->andWhere('e.isArchived = false') - ->orderBy('e.'.$sortBy, $direction) ; } /** * Retrieves read entries for a user. * - * @param int $userId + * @param int $userId + * @param string $sortBy Field to sort + * @param string $direction Direction of the order * * @return QueryBuilder */ - public function getBuilderForArchiveByUser($userId, $sortBy = 'id', $direction = 'DESC') + public function getBuilderForArchiveByUser($userId, $sortBy = 'archivedAt', $direction = 'DESC') { return $this - ->getSortedQueryBuilderByUser($userId, 'archivedAt', 'desc') + ->getSortedQueryBuilderByUser($userId, $sortBy, $direction) ->andWhere('e.isArchived = true') - ->orderBy('e.'.$sortBy, $direction) ; } /** * Retrieves starred entries for a user. * - * @param int $userId + * @param int $userId + * @param string $sortBy Field to sort + * @param string $direction Direction of the order * * @return QueryBuilder */ - public function getBuilderForStarredByUser($userId, $sortBy = 'id', $direction = 'DESC') + public function getBuilderForStarredByUser($userId, $sortBy = 'starredAt', $direction = 'DESC') { return $this - ->getSortedQueryBuilderByUser($userId, 'starredAt', 'desc') + ->getSortedQueryBuilderByUser($userId, $sortBy, $direction) ->andWhere('e.isStarred = true') - ->orderBy('e.'.$sortBy, $direction) ; }