aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
authorJeremy Benoist <jeremy.benoist@gmail.com>2016-11-03 16:41:29 +0100
committerJeremy Benoist <jeremy.benoist@gmail.com>2016-11-03 16:41:29 +0100
commit5a619812ca3eb05a82a023ccdaee13501eb8d45f (patch)
treea1541999a3e13f9bb8b45d3a61320ee61aa4eb3c /src/Wallabag/CoreBundle/Controller
parentda4136557963018287cae61226e9006c3c741747 (diff)
parent84795d015b3c7e1af48a3dda3cb33cf080b66e8f (diff)
downloadwallabag-5a619812ca3eb05a82a023ccdaee13501eb8d45f.tar.gz
wallabag-5a619812ca3eb05a82a023ccdaee13501eb8d45f.tar.zst
wallabag-5a619812ca3eb05a82a023ccdaee13501eb8d45f.zip
Merge remote-tracking branch 'origin/master' into 2.2
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/ExportController.php23
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php1
2 files changed, 18 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php
index 6191d5d7..79653cfe 100644
--- a/src/Wallabag/CoreBundle/Controller/ExportController.php
+++ b/src/Wallabag/CoreBundle/Controller/ExportController.php
@@ -4,8 +4,10 @@ namespace Wallabag\CoreBundle\Controller;
4 4
5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 5use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller; 6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request;
7use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
8use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tag;
9 11
10/** 12/**
11 * The try/catch can be removed once all formats will be implemented. 13 * The try/catch can be removed once all formats will be implemented.
@@ -51,15 +53,24 @@ class ExportController extends Controller
51 * 53 *
52 * @return \Symfony\Component\HttpFoundation\Response 54 * @return \Symfony\Component\HttpFoundation\Response
53 */ 55 */
54 public function downloadEntriesAction($format, $category) 56 public function downloadEntriesAction(Request $request, $format, $category)
55 { 57 {
56 $method = ucfirst($category); 58 $method = ucfirst($category);
57 $methodBuilder = 'getBuilderFor'.$method.'ByUser'; 59 $methodBuilder = 'getBuilderFor'.$method.'ByUser';
58 $entries = $this->getDoctrine() 60
59 ->getRepository('WallabagCoreBundle:Entry') 61 if ($category == 'tag_entries') {
60 ->$methodBuilder($this->getUser()->getId()) 62 $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneBySlug($request->query->get('tag'));
61 ->getQuery() 63
62 ->getResult(); 64 $entries = $this->getDoctrine()
65 ->getRepository('WallabagCoreBundle:Entry')
66 ->findAllByTagId($this->getUser()->getId(), $tag->getId());
67 } else {
68 $entries = $this->getDoctrine()
69 ->getRepository('WallabagCoreBundle:Entry')
70 ->$methodBuilder($this->getUser()->getId())
71 ->getQuery()
72 ->getResult();
73 }
63 74
64 try { 75 try {
65 return $this->get('wallabag_core.helper.entries_export') 76 return $this->get('wallabag_core.helper.entries_export')
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 4542d484..a3e70fd0 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -143,6 +143,7 @@ class TagController extends Controller
143 'form' => null, 143 'form' => null,
144 'entries' => $entries, 144 'entries' => $entries,
145 'currentPage' => $page, 145 'currentPage' => $page,
146 'tag' => $tag->getLabel(),
146 ]); 147 ]);
147 } 148 }
148} 149}