From 2686457448372543fdf4f1fc54c4fd20f0f02c2c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 7 Aug 2015 22:20:30 +0200 Subject: store estimated reading time / filters on reading time --- .../CoreBundle/Repository/EntryRepository.php | 36 ++++++---------------- 1 file changed, 9 insertions(+), 27 deletions(-) (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php') diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index a4514d9e..f885ee94 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -13,20 +13,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findUnreadByUser($userId) { - $qb = $this->createQueryBuilder('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isArchived = false') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** @@ -34,21 +29,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findArchiveByUser($userId) { - $qb = $this->createQueryBuilder('e') - ->select('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isArchived = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** @@ -56,22 +45,15 @@ class EntryRepository extends EntityRepository * * @param int $userId * - * @return Pagerfanta + * @return QueryBuilder */ public function findStarredByUser($userId) { - - $qb = $this->createQueryBuilder('e') - ->select('e') + return $this->createQueryBuilder('e') ->leftJoin('e.user', 'u') ->where('e.isStarred = true') ->andWhere('u.id =:userId')->setParameter('userId', $userId) - ->orderBy('e.id', 'desc') - ->getQuery(); - - $pagerAdapter = new DoctrineORMAdapter($qb); - - return new Pagerfanta($pagerAdapter); + ->orderBy('e.id', 'desc'); } /** -- cgit v1.2.3