]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Repository/EntryRepository.php
Fix `getBuilderForUntaggedByUser`
[github/wallabag/wallabag.git] / 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);
     }
 
     /**