diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/ExportController.php | 23 |
1 files changed, 17 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 | ||
5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; | 5 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; | 6 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
7 | use Symfony\Component\HttpFoundation\Request; | ||
7 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; | 8 | use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; |
8 | use Wallabag\CoreBundle\Entity\Entry; | 9 | use Wallabag\CoreBundle\Entity\Entry; |
10 | use 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') |