diff --git a/app/config/services.yml b/app/config/services.yml index 95b8f26f5..76bbce27c 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -18,7 +18,9 @@ services: public: false arguments: - "@wallabag_core.entry_repository" + - "@wallabag_core.tag_repository" - "@security.token_storage" + - "%wallabag_core.cache_lifetime%" tags: - { name: twig.extension } diff --git a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php index 869fdc56a..07fedeb01 100644 --- a/src/Wallabag/ApiBundle/Controller/WallabagRestController.php +++ b/src/Wallabag/ApiBundle/Controller/WallabagRestController.php @@ -322,7 +322,9 @@ class WallabagRestController extends FOSRestController $tags = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Tag') - ->findAllTags($this->getUser()->getId()); + ->findAllTags($this->getUser()->getId()) + ->getQuery() + ->getResult(); $json = $this->get('serializer')->serialize($tags, 'json'); diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php index 1cbc413d6..bc95a4d34 100644 --- a/src/Wallabag/CoreBundle/Controller/TagController.php +++ b/src/Wallabag/CoreBundle/Controller/TagController.php @@ -84,7 +84,9 @@ class TagController extends Controller { $tags = $this->getDoctrine() ->getRepository('WallabagCoreBundle:Tag') - ->findAllTags($this->getUser()->getId()); + ->findAllTags($this->getUser()->getId()) + ->getQuery() + ->getResult(); return $this->render( 'WallabagCoreBundle:Tag:tags.html.twig', diff --git a/src/Wallabag/CoreBundle/Repository/EntryRepository.php b/src/Wallabag/CoreBundle/Repository/EntryRepository.php index 24d1a57af..302e5a538 100644 --- a/src/Wallabag/CoreBundle/Repository/EntryRepository.php +++ b/src/Wallabag/CoreBundle/Repository/EntryRepository.php @@ -10,8 +10,6 @@ use Wallabag\CoreBundle\Entity\Tag; class EntryRepository extends EntityRepository { - private $lifeTime; - /** * Return a query builder to used by other getBuilderFor* method. * @@ -311,25 +309,4 @@ class EntryRepository extends EntityRepository return $qb->getQuery()->getSingleScalarResult(); } - - public function setLifeTime($lifeTime) - { - $this->lifeTime = $lifeTime; - } - - /** - * Enable cache for a query. - * - * @param Query $query - * - * @return Query - */ - public function enableCache(Query $query) - { - $query->useQueryCache(true); - $query->useResultCache(true); - $query->setResultCacheLifetime($this->lifeTime); - - return $query; - } } diff --git a/src/Wallabag/CoreBundle/Repository/TagRepository.php b/src/Wallabag/CoreBundle/Repository/TagRepository.php index abf915fe5..41f616079 100644 --- a/src/Wallabag/CoreBundle/Repository/TagRepository.php +++ b/src/Wallabag/CoreBundle/Repository/TagRepository.php @@ -17,9 +17,7 @@ class TagRepository extends EntityRepository { return $this->createQueryBuilder('t') ->leftJoin('t.entries', 'e') - ->where('e.user = :userId')->setParameter('userId', $userId) - ->getQuery() - ->getResult(); + ->where('e.user = :userId')->setParameter('userId', $userId); } /** diff --git a/src/Wallabag/CoreBundle/Resources/config/services.yml b/src/Wallabag/CoreBundle/Resources/config/services.yml index 1c1457e70..e95ef4520 100644 --- a/src/Wallabag/CoreBundle/Resources/config/services.yml +++ b/src/Wallabag/CoreBundle/Resources/config/services.yml @@ -81,8 +81,6 @@ services: factory: [ "@doctrine.orm.default_entity_manager", getRepository ] arguments: - WallabagCoreBundle:Entry - calls: - - [ setLifeTime, [ "%wallabag_core.cache_lifetime%" ] ] wallabag_core.tag_repository: class: Wallabag\CoreBundle\Repository\TagRepository diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig index 06ecbf3d2..b70198da6 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/layout.html.twig @@ -47,7 +47,7 @@ {{ 'menu.left.all_articles'|trans }} {{ count_entries('all') }}