aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorJérémy Benoist <j0k3r@users.noreply.github.com>2017-08-30 13:53:49 +0200
committerGitHub <noreply@github.com>2017-08-30 13:53:49 +0200
commit119e6c5edb93ab8a14fd46d04d224091542039c4 (patch)
tree521a316a60c7bd162bb52a86f55a8bf4e3c6f475 /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parent854616ac6d6246e8e0451342ab841985b401604d (diff)
parenta991c46eedec0efb24d0a9974b1c7fcabf8cfa66 (diff)
downloadwallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.tar.gz
wallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.tar.zst
wallabag-119e6c5edb93ab8a14fd46d04d224091542039c4.zip
Merge pull request #3330 from franek/set-starred-date
Add starred_at field which is set when an entry is starred
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index eb5e3205..ecc159fc 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -65,7 +65,7 @@ class EntryRepository extends EntityRepository
65 public function getBuilderForStarredByUser($userId) 65 public function getBuilderForStarredByUser($userId)
66 { 66 {
67 return $this 67 return $this
68 ->getBuilderByUser($userId) 68 ->getBuilderByUser($userId, 'starredAt', 'desc')
69 ->andWhere('e.isStarred = true') 69 ->andWhere('e.isStarred = true')
70 ; 70 ;
71 } 71 }
@@ -401,15 +401,16 @@ class EntryRepository extends EntityRepository
401 /** 401 /**
402 * Return a query builder to used by other getBuilderFor* method. 402 * Return a query builder to used by other getBuilderFor* method.
403 * 403 *
404 * @param int $userId 404 * @param int $userId
405 * @param string $sortBy
406 * @param string $direction
405 * 407 *
406 * @return QueryBuilder 408 * @return QueryBuilder
407 */ 409 */
408 private function getBuilderByUser($userId) 410 private function getBuilderByUser($userId, $sortBy = 'createdAt', $direction = 'desc')
409 { 411 {
410 return $this->createQueryBuilder('e') 412 return $this->createQueryBuilder('e')
411 ->andWhere('e.user = :userId')->setParameter('userId', $userId) 413 ->andWhere('e.user = :userId')->setParameter('userId', $userId)
412 ->orderBy('e.createdAt', 'desc') 414 ->orderBy(sprintf('e.%s', $sortBy), $direction);
413 ;
414 } 415 }
415} 416}