aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Repository/EntryRepository.php
diff options
context:
space:
mode:
authorJeremy Benoist <j0k3r@users.noreply.github.com>2016-09-03 16:13:08 +0200
committerGitHub <noreply@github.com>2016-09-03 16:13:08 +0200
commit8f8654913ce82be12219a37a24630066bbe950c2 (patch)
tree303a416dc4fd95bc124abaaf183f2ca9f39494d8 /src/Wallabag/CoreBundle/Repository/EntryRepository.php
parent9972ab467af3a9d6d1c7f3588dbb940b38298aaa (diff)
parentb3f4a11a81b520b8dcc2bcebeeafea2cc0338a70 (diff)
downloadwallabag-8f8654913ce82be12219a37a24630066bbe950c2.tar.gz
wallabag-8f8654913ce82be12219a37a24630066bbe950c2.tar.zst
wallabag-8f8654913ce82be12219a37a24630066bbe950c2.zip
Merge pull request #2002 from wallabag/feature-display-itemsNumber
Feature display items number
Diffstat (limited to 'src/Wallabag/CoreBundle/Repository/EntryRepository.php')
-rw-r--r--src/Wallabag/CoreBundle/Repository/EntryRepository.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
index e5c21679..24d1a57a 100644
--- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php
+++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php
@@ -3,12 +3,15 @@
3namespace Wallabag\CoreBundle\Repository; 3namespace Wallabag\CoreBundle\Repository;
4 4
5use Doctrine\ORM\EntityRepository; 5use Doctrine\ORM\EntityRepository;
6use Doctrine\ORM\Query;
6use Pagerfanta\Adapter\DoctrineORMAdapter; 7use Pagerfanta\Adapter\DoctrineORMAdapter;
7use Pagerfanta\Pagerfanta; 8use Pagerfanta\Pagerfanta;
8use Wallabag\CoreBundle\Entity\Tag; 9use Wallabag\CoreBundle\Entity\Tag;
9 10
10class EntryRepository extends EntityRepository 11class EntryRepository extends EntityRepository
11{ 12{
13 private $lifeTime;
14
12 /** 15 /**
13 * Return a query builder to used by other getBuilderFor* method. 16 * Return a query builder to used by other getBuilderFor* method.
14 * 17 *
@@ -308,4 +311,25 @@ class EntryRepository extends EntityRepository
308 311
309 return $qb->getQuery()->getSingleScalarResult(); 312 return $qb->getQuery()->getSingleScalarResult();
310 } 313 }
314
315 public function setLifeTime($lifeTime)
316 {
317 $this->lifeTime = $lifeTime;
318 }
319
320 /**
321 * Enable cache for a query.
322 *
323 * @param Query $query
324 *
325 * @return Query
326 */
327 public function enableCache(Query $query)
328 {
329 $query->useQueryCache(true);
330 $query->useResultCache(true);
331 $query->setResultCacheLifetime($this->lifeTime);
332
333 return $query;
334 }
311} 335}