]> git.immae.eu Git - github/wallabag/wallabag.git/commitdiff
Fix `getBuilderForUntaggedByUser`
authorJeremy Benoist <jeremy.benoist@gmail.com>
Fri, 14 Jun 2019 08:34:37 +0000 (10:34 +0200)
committerNicolas LÅ“uillet <nicolas@loeuillet.org>
Tue, 28 Apr 2020 08:13:58 +0000 (10:13 +0200)
src/Wallabag/CoreBundle/Repository/EntryRepository.php

index aa761df38fd127e4fe9f8d7115d522b27a310361..347e1b97d321636fe4a7271f373531ed99857646 100644 (file)
@@ -122,13 +122,17 @@ class EntryRepository extends EntityRepository
     /**
      * Retrieve a sorted list of untagged 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 getBuilderForUntaggedByUser($userId)
+    public function getBuilderForUntaggedByUser($userId, $sortBy = 'starredAt', $direction = 'DESC')
     {
-        return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId));
+        $sortBy = $sortBy ?: 'id';
+
+        return $this->sortQueryBuilder($this->getRawBuilderForUntaggedByUser($userId), $sortBy, $direction);
     }
 
     /**