aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Wallabag/CoreBundle/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller')
-rw-r--r--src/Wallabag/CoreBundle/Controller/ConfigController.php21
-rw-r--r--src/Wallabag/CoreBundle/Controller/ExportController.php14
-rw-r--r--src/Wallabag/CoreBundle/Controller/RssController.php106
-rw-r--r--src/Wallabag/CoreBundle/Controller/SiteCredentialController.php174
-rw-r--r--src/Wallabag/CoreBundle/Controller/TagController.php20
5 files changed, 294 insertions, 41 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ConfigController.php b/src/Wallabag/CoreBundle/Controller/ConfigController.php
index 89d27425..d4170d39 100644
--- a/src/Wallabag/CoreBundle/Controller/ConfigController.php
+++ b/src/Wallabag/CoreBundle/Controller/ConfigController.php
@@ -152,8 +152,7 @@ class ConfigController extends Controller
152 ], 152 ],
153 'twofactor_auth' => $this->getParameter('twofactor_auth'), 153 'twofactor_auth' => $this->getParameter('twofactor_auth'),
154 'wallabag_url' => $this->getParameter('domain_name'), 154 'wallabag_url' => $this->getParameter('domain_name'),
155 'enabled_users' => $this->getDoctrine() 155 'enabled_users' => $this->get('wallabag_user.user_repository')
156 ->getRepository('WallabagUserBundle:User')
157 ->getSumEnabledUsers(), 156 ->getSumEnabledUsers(),
158 ]); 157 ]);
159 } 158 }
@@ -257,9 +256,7 @@ class ConfigController extends Controller
257 // manually remove tags to avoid orphan tag 256 // manually remove tags to avoid orphan tag
258 $this->removeAllTagsByUserId($this->getUser()->getId()); 257 $this->removeAllTagsByUserId($this->getUser()->getId());
259 258
260 $this->getDoctrine() 259 $this->get('wallabag_core.entry_repository')->removeAllByUserId($this->getUser()->getId());
261 ->getRepository('WallabagCoreBundle:Entry')
262 ->removeAllByUserId($this->getUser()->getId());
263 break; 260 break;
264 case 'archived': 261 case 'archived':
265 if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) { 262 if ($this->get('doctrine')->getConnection()->getDatabasePlatform() instanceof \Doctrine\DBAL\Platforms\SqlitePlatform) {
@@ -269,9 +266,7 @@ class ConfigController extends Controller
269 // manually remove tags to avoid orphan tag 266 // manually remove tags to avoid orphan tag
270 $this->removeTagsForArchivedByUserId($this->getUser()->getId()); 267 $this->removeTagsForArchivedByUserId($this->getUser()->getId());
271 268
272 $this->getDoctrine() 269 $this->get('wallabag_core.entry_repository')->removeArchivedByUserId($this->getUser()->getId());
273 ->getRepository('WallabagCoreBundle:Entry')
274 ->removeArchivedByUserId($this->getUser()->getId());
275 break; 270 break;
276 } 271 }
277 272
@@ -295,8 +290,7 @@ class ConfigController extends Controller
295 return; 290 return;
296 } 291 }
297 292
298 $this->getDoctrine() 293 $this->get('wallabag_core.entry_repository')
299 ->getRepository('WallabagCoreBundle:Entry')
300 ->removeTags($userId, $tags); 294 ->removeTags($userId, $tags);
301 295
302 // cleanup orphan tags 296 // cleanup orphan tags
@@ -318,7 +312,7 @@ class ConfigController extends Controller
318 */ 312 */
319 private function removeAllTagsByUserId($userId) 313 private function removeAllTagsByUserId($userId)
320 { 314 {
321 $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findAllTags($userId); 315 $tags = $this->get('wallabag_core.tag_repository')->findAllTags($userId);
322 $this->removeAllTagsByStatusAndUserId($tags, $userId); 316 $this->removeAllTagsByStatusAndUserId($tags, $userId);
323 } 317 }
324 318
@@ -329,7 +323,7 @@ class ConfigController extends Controller
329 */ 323 */
330 private function removeTagsForArchivedByUserId($userId) 324 private function removeTagsForArchivedByUserId($userId)
331 { 325 {
332 $tags = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findForArchivedArticlesByUser($userId); 326 $tags = $this->get('wallabag_core.tag_repository')->findForArchivedArticlesByUser($userId);
333 $this->removeAllTagsByStatusAndUserId($tags, $userId); 327 $this->removeAllTagsByStatusAndUserId($tags, $userId);
334 } 328 }
335 329
@@ -393,8 +387,7 @@ class ConfigController extends Controller
393 */ 387 */
394 public function deleteAccountAction(Request $request) 388 public function deleteAccountAction(Request $request)
395 { 389 {
396 $enabledUsers = $this->getDoctrine() 390 $enabledUsers = $this->get('wallabag_user.user_repository')
397 ->getRepository('WallabagUserBundle:User')
398 ->getSumEnabledUsers(); 391 ->getSumEnabledUsers();
399 392
400 if ($enabledUsers <= 1) { 393 if ($enabledUsers <= 1) {
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php
index abc3336a..fda04cfb 100644
--- a/src/Wallabag/CoreBundle/Controller/ExportController.php
+++ b/src/Wallabag/CoreBundle/Controller/ExportController.php
@@ -7,7 +7,6 @@ use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Symfony\Component\HttpFoundation\Request; 7use Symfony\Component\HttpFoundation\Request;
8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; 8use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
9use Wallabag\CoreBundle\Entity\Entry; 9use Wallabag\CoreBundle\Entity\Entry;
10use Wallabag\CoreBundle\Entity\Tag;
11 10
12/** 11/**
13 * The try/catch can be removed once all formats will be implemented. 12 * The try/catch can be removed once all formats will be implemented.
@@ -57,16 +56,17 @@ class ExportController extends Controller
57 { 56 {
58 $method = ucfirst($category); 57 $method = ucfirst($category);
59 $methodBuilder = 'getBuilderFor'.$method.'ByUser'; 58 $methodBuilder = 'getBuilderFor'.$method.'ByUser';
59 $repository = $this->get('wallabag_core.entry_repository');
60 60
61 if ($category == 'tag_entries') { 61 if ($category == 'tag_entries') {
62 $tag = $this->getDoctrine()->getRepository('WallabagCoreBundle:Tag')->findOneBySlug($request->query->get('tag')); 62 $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
63 63
64 $entries = $this->getDoctrine() 64 $entries = $repository->findAllByTagId(
65 ->getRepository('WallabagCoreBundle:Entry') 65 $this->getUser()->getId(),
66 ->findAllByTagId($this->getUser()->getId(), $tag->getId()); 66 $tag->getId()
67 );
67 } else { 68 } else {
68 $entries = $this->getDoctrine() 69 $entries = $repository
69 ->getRepository('WallabagCoreBundle:Entry')
70 ->$methodBuilder($this->getUser()->getId()) 70 ->$methodBuilder($this->getUser()->getId())
71 ->getQuery() 71 ->getQuery()
72 ->getResult(); 72 ->getResult();
diff --git a/src/Wallabag/CoreBundle/Controller/RssController.php b/src/Wallabag/CoreBundle/Controller/RssController.php
index 92f18707..e87dd9a1 100644
--- a/src/Wallabag/CoreBundle/Controller/RssController.php
+++ b/src/Wallabag/CoreBundle/Controller/RssController.php
@@ -3,13 +3,16 @@
3namespace Wallabag\CoreBundle\Controller; 3namespace Wallabag\CoreBundle\Controller;
4 4
5use Pagerfanta\Adapter\DoctrineORMAdapter; 5use Pagerfanta\Adapter\DoctrineORMAdapter;
6use Pagerfanta\Adapter\ArrayAdapter;
6use Pagerfanta\Exception\OutOfRangeCurrentPageException; 7use Pagerfanta\Exception\OutOfRangeCurrentPageException;
7use Pagerfanta\Pagerfanta; 8use Pagerfanta\Pagerfanta;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter; 9use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
9use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; 10use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
10use Symfony\Component\HttpFoundation\Request; 11use Symfony\Component\HttpFoundation\Request;
12use Symfony\Component\HttpFoundation\Response;
11use Symfony\Bundle\FrameworkBundle\Controller\Controller; 13use Symfony\Bundle\FrameworkBundle\Controller\Controller;
12use Wallabag\CoreBundle\Entity\Entry; 14use Wallabag\CoreBundle\Entity\Entry;
15use Wallabag\CoreBundle\Entity\Tag;
13use Wallabag\UserBundle\Entity\User; 16use Wallabag\UserBundle\Entity\User;
14use Symfony\Component\Routing\Generator\UrlGeneratorInterface; 17use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
15 18
@@ -23,7 +26,7 @@ class RssController extends Controller
23 * 26 *
24 * @return \Symfony\Component\HttpFoundation\Response 27 * @return \Symfony\Component\HttpFoundation\Response
25 */ 28 */
26 public function showUnreadAction(Request $request, User $user) 29 public function showUnreadRSSAction(Request $request, User $user)
27 { 30 {
28 return $this->showEntries('unread', $user, $request->query->get('page', 1)); 31 return $this->showEntries('unread', $user, $request->query->get('page', 1));
29 } 32 }
@@ -31,12 +34,12 @@ class RssController extends Controller
31 /** 34 /**
32 * Shows read entries for current user. 35 * Shows read entries for current user.
33 * 36 *
34 * @Route("/{username}/{token}/archive.xml", name="archive_rss") 37 * @Route("/{username}/{token}/archive.xml", name="archive_rss", defaults={"_format"="xml"})
35 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") 38 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter")
36 * 39 *
37 * @return \Symfony\Component\HttpFoundation\Response 40 * @return \Symfony\Component\HttpFoundation\Response
38 */ 41 */
39 public function showArchiveAction(Request $request, User $user) 42 public function showArchiveRSSAction(Request $request, User $user)
40 { 43 {
41 return $this->showEntries('archive', $user, $request->query->get('page', 1)); 44 return $this->showEntries('archive', $user, $request->query->get('page', 1));
42 } 45 }
@@ -44,17 +47,89 @@ class RssController extends Controller
44 /** 47 /**
45 * Shows starred entries for current user. 48 * Shows starred entries for current user.
46 * 49 *
47 * @Route("/{username}/{token}/starred.xml", name="starred_rss") 50 * @Route("/{username}/{token}/starred.xml", name="starred_rss", defaults={"_format"="xml"})
48 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter") 51 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter")
49 * 52 *
50 * @return \Symfony\Component\HttpFoundation\Response 53 * @return \Symfony\Component\HttpFoundation\Response
51 */ 54 */
52 public function showStarredAction(Request $request, User $user) 55 public function showStarredRSSAction(Request $request, User $user)
53 { 56 {
54 return $this->showEntries('starred', $user, $request->query->get('page', 1)); 57 return $this->showEntries('starred', $user, $request->query->get('page', 1));
55 } 58 }
56 59
57 /** 60 /**
61 * Shows all entries for current user.
62 *
63 * @Route("/{username}/{token}/all.xml", name="all_rss", defaults={"_format"="xml"})
64 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter")
65 *
66 * @return \Symfony\Component\HttpFoundation\Response
67 */
68 public function showAllRSSAction(Request $request, User $user)
69 {
70 return $this->showEntries('all', $user, $request->query->get('page', 1));
71 }
72
73 /**
74 * Shows entries associated to a tag for current user.
75 *
76 * @Route("/{username}/{token}/tags/{slug}.xml", name="tag_rss", defaults={"_format"="xml"})
77 * @ParamConverter("user", class="WallabagUserBundle:User", converter="username_rsstoken_converter")
78 * @ParamConverter("tag", options={"mapping": {"slug": "slug"}})
79 *
80 * @return \Symfony\Component\HttpFoundation\Response
81 */
82 public function showTagsAction(Request $request, User $user, Tag $tag)
83 {
84 $page = $request->query->get('page', 1);
85
86 $url = $this->generateUrl(
87 'tag_rss',
88 [
89 'username' => $user->getUsername(),
90 'token' => $user->getConfig()->getRssToken(),
91 'slug' => $tag->getSlug(),
92 ],
93 UrlGeneratorInterface::ABSOLUTE_URL
94 );
95
96 $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId(
97 $user->getId(),
98 $tag->getId()
99 );
100
101 $pagerAdapter = new ArrayAdapter($entriesByTag);
102
103 $entries = $this->get('wallabag_core.helper.prepare_pager_for_entries')->prepare(
104 $pagerAdapter,
105 $user
106 );
107
108 if (null === $entries) {
109 throw $this->createNotFoundException('No entries found?');
110 }
111
112 try {
113 $entries->setCurrentPage($page);
114 } catch (OutOfRangeCurrentPageException $e) {
115 if ($page > 1) {
116 return $this->redirect($url.'?page='.$entries->getNbPages(), 302);
117 }
118 }
119
120 return $this->render(
121 '@WallabagCore/themes/common/Entry/entries.xml.twig',
122 [
123 'url_html' => $this->generateUrl('tag_entries', ['slug' => $tag->getSlug()], UrlGeneratorInterface::ABSOLUTE_URL),
124 'type' => 'tag ('.$tag->getLabel().')',
125 'url' => $url,
126 'entries' => $entries,
127 ],
128 new Response('', 200, ['Content-Type' => 'application/rss+xml'])
129 );
130 }
131
132 /**
58 * Global method to retrieve entries depending on the given type 133 * Global method to retrieve entries depending on the given type
59 * It returns the response to be send. 134 * It returns the response to be send.
60 * 135 *
@@ -66,7 +141,7 @@ class RssController extends Controller
66 */ 141 */
67 private function showEntries($type, User $user, $page = 1) 142 private function showEntries($type, User $user, $page = 1)
68 { 143 {
69 $repository = $this->getDoctrine()->getRepository('WallabagCoreBundle:Entry'); 144 $repository = $this->get('wallabag_core.entry_repository');
70 145
71 switch ($type) { 146 switch ($type) {
72 case 'starred': 147 case 'starred':
@@ -81,6 +156,10 @@ class RssController extends Controller
81 $qb = $repository->getBuilderForUnreadByUser($user->getId()); 156 $qb = $repository->getBuilderForUnreadByUser($user->getId());
82 break; 157 break;
83 158
159 case 'all':
160 $qb = $repository->getBuilderForAllByUser($user->getId());
161 break;
162
84 default: 163 default:
85 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); 164 throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type));
86 } 165 }
@@ -108,10 +187,15 @@ class RssController extends Controller
108 } 187 }
109 } 188 }
110 189
111 return $this->render('@WallabagCore/themes/common/Entry/entries.xml.twig', [ 190 return $this->render(
112 'type' => $type, 191 '@WallabagCore/themes/common/Entry/entries.xml.twig',
113 'url' => $url, 192 [
114 'entries' => $entries, 193 'url_html' => $this->generateUrl($type, [], UrlGeneratorInterface::ABSOLUTE_URL),
115 ]); 194 'type' => $type,
195 'url' => $url,
196 'entries' => $entries,
197 ],
198 new Response('', 200, ['Content-Type' => 'application/rss+xml'])
199 );
116 } 200 }
117} 201}
diff --git a/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
new file mode 100644
index 00000000..98781dab
--- /dev/null
+++ b/src/Wallabag/CoreBundle/Controller/SiteCredentialController.php
@@ -0,0 +1,174 @@
1<?php
2
3namespace Wallabag\CoreBundle\Controller;
4
5use Symfony\Component\HttpFoundation\Request;
6use Symfony\Bundle\FrameworkBundle\Controller\Controller;
7use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
8use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
9use Wallabag\UserBundle\Entity\User;
10use Wallabag\CoreBundle\Entity\SiteCredential;
11
12/**
13 * SiteCredential controller.
14 *
15 * @Route("/site-credentials")
16 */
17class SiteCredentialController extends Controller
18{
19 /**
20 * Lists all User entities.
21 *
22 * @Route("/", name="site_credentials_index")
23 * @Method("GET")
24 */
25 public function indexAction()
26 {
27 $credentials = $this->get('wallabag_core.site_credential_repository')->findByUser($this->getUser());
28
29 return $this->render('WallabagCoreBundle:SiteCredential:index.html.twig', [
30 'credentials' => $credentials,
31 ]);
32 }
33
34 /**
35 * Creates a new site credential entity.
36 *
37 * @Route("/new", name="site_credentials_new")
38 * @Method({"GET", "POST"})
39 *
40 * @param Request $request
41 *
42 * @return \Symfony\Component\HttpFoundation\Response
43 */
44 public function newAction(Request $request)
45 {
46 $credential = new SiteCredential($this->getUser());
47
48 $form = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $credential);
49 $form->handleRequest($request);
50
51 if ($form->isSubmitted() && $form->isValid()) {
52 $credential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getUsername()));
53 $credential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($credential->getPassword()));
54
55 $em = $this->getDoctrine()->getManager();
56 $em->persist($credential);
57 $em->flush();
58
59 $this->get('session')->getFlashBag()->add(
60 'notice',
61 $this->get('translator')->trans('flashes.site_credential.notice.added', ['%host%' => $credential->getHost()])
62 );
63
64 return $this->redirectToRoute('site_credentials_index');
65 }
66
67 return $this->render('WallabagCoreBundle:SiteCredential:new.html.twig', [
68 'credential' => $credential,
69 'form' => $form->createView(),
70 ]);
71 }
72
73 /**
74 * Displays a form to edit an existing site credential entity.
75 *
76 * @Route("/{id}/edit", name="site_credentials_edit")
77 * @Method({"GET", "POST"})
78 *
79 * @param Request $request
80 * @param SiteCredential $siteCredential
81 *
82 * @return \Symfony\Component\HttpFoundation\Response
83 */
84 public function editAction(Request $request, SiteCredential $siteCredential)
85 {
86 $this->checkUserAction($siteCredential);
87
88 $deleteForm = $this->createDeleteForm($siteCredential);
89 $editForm = $this->createForm('Wallabag\CoreBundle\Form\Type\SiteCredentialType', $siteCredential);
90 $editForm->handleRequest($request);
91
92 if ($editForm->isSubmitted() && $editForm->isValid()) {
93 $siteCredential->setUsername($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getUsername()));
94 $siteCredential->setPassword($this->get('wallabag_core.helper.crypto_proxy')->crypt($siteCredential->getPassword()));
95
96 $em = $this->getDoctrine()->getManager();
97 $em->persist($siteCredential);
98 $em->flush();
99
100 $this->get('session')->getFlashBag()->add(
101 'notice',
102 $this->get('translator')->trans('flashes.site_credential.notice.updated', ['%host%' => $siteCredential->getHost()])
103 );
104
105 return $this->redirectToRoute('site_credentials_index');
106 }
107
108 return $this->render('WallabagCoreBundle:SiteCredential:edit.html.twig', [
109 'credential' => $siteCredential,
110 'edit_form' => $editForm->createView(),
111 'delete_form' => $deleteForm->createView(),
112 ]);
113 }
114
115 /**
116 * Deletes a site credential entity.
117 *
118 * @Route("/{id}", name="site_credentials_delete")
119 * @Method("DELETE")
120 *
121 * @param Request $request
122 * @param SiteCredential $siteCredential
123 *
124 * @return \Symfony\Component\HttpFoundation\RedirectResponse
125 */
126 public function deleteAction(Request $request, SiteCredential $siteCredential)
127 {
128 $this->checkUserAction($siteCredential);
129
130 $form = $this->createDeleteForm($siteCredential);
131 $form->handleRequest($request);
132
133 if ($form->isSubmitted() && $form->isValid()) {
134 $this->get('session')->getFlashBag()->add(
135 'notice',
136 $this->get('translator')->trans('flashes.site_credential.notice.deleted', ['%host%' => $siteCredential->getHost()])
137 );
138
139 $em = $this->getDoctrine()->getManager();
140 $em->remove($siteCredential);
141 $em->flush();
142 }
143
144 return $this->redirectToRoute('site_credentials_index');
145 }
146
147 /**
148 * Creates a form to delete a site credential entity.
149 *
150 * @param SiteCredential $siteCredential The site credential entity
151 *
152 * @return \Symfony\Component\Form\Form The form
153 */
154 private function createDeleteForm(SiteCredential $siteCredential)
155 {
156 return $this->createFormBuilder()
157 ->setAction($this->generateUrl('site_credentials_delete', ['id' => $siteCredential->getId()]))
158 ->setMethod('DELETE')
159 ->getForm()
160 ;
161 }
162
163 /**
164 * Check if the logged user can manage the given site credential.
165 *
166 * @param SiteCredential $siteCredential The site credential entity
167 */
168 private function checkUserAction(SiteCredential $siteCredential)
169 {
170 if (null === $this->getUser() || $this->getUser()->getId() != $siteCredential->getUser()->getId()) {
171 throw $this->createAccessDeniedException('You can not access this site credential.');
172 }
173 }
174}
diff --git a/src/Wallabag/CoreBundle/Controller/TagController.php b/src/Wallabag/CoreBundle/Controller/TagController.php
index 9422bae4..a8b1eadd 100644
--- a/src/Wallabag/CoreBundle/Controller/TagController.php
+++ b/src/Wallabag/CoreBundle/Controller/TagController.php
@@ -84,16 +84,17 @@ class TagController extends Controller
84 */ 84 */
85 public function showTagAction() 85 public function showTagAction()
86 { 86 {
87 $tags = $this->getDoctrine() 87 $repository = $this->get('wallabag_core.entry_repository');
88 ->getRepository('WallabagCoreBundle:Tag') 88 $tags = $this->get('wallabag_core.tag_repository')
89 ->findAllTags($this->getUser()->getId()); 89 ->findAllTags($this->getUser()->getId());
90 90
91 $flatTags = []; 91 $flatTags = [];
92 92
93 foreach ($tags as $tag) { 93 foreach ($tags as $tag) {
94 $nbEntries = $this->getDoctrine() 94 $nbEntries = $repository->countAllEntriesByUserIdAndTagId(
95 ->getRepository('WallabagCoreBundle:Entry') 95 $this->getUser()->getId(),
96 ->countAllEntriesByUserIdAndTagId($this->getUser()->getId(), $tag->getId()); 96 $tag->getId()
97 );
97 98
98 $flatTags[] = [ 99 $flatTags[] = [
99 'id' => $tag->getId(), 100 'id' => $tag->getId(),
@@ -119,9 +120,10 @@ class TagController extends Controller
119 */ 120 */
120 public function showEntriesForTagAction(Tag $tag, $page, Request $request) 121 public function showEntriesForTagAction(Tag $tag, $page, Request $request)
121 { 122 {
122 $entriesByTag = $this->getDoctrine() 123 $entriesByTag = $this->get('wallabag_core.entry_repository')->findAllByTagId(
123 ->getRepository('WallabagCoreBundle:Entry') 124 $this->getUser()->getId(),
124 ->findAllByTagId($this->getUser()->getId(), $tag->getId()); 125 $tag->getId()
126 );
125 127
126 $pagerAdapter = new ArrayAdapter($entriesByTag); 128 $pagerAdapter = new ArrayAdapter($entriesByTag);
127 129
@@ -142,7 +144,7 @@ class TagController extends Controller
142 'form' => null, 144 'form' => null,
143 'entries' => $entries, 145 'entries' => $entries,
144 'currentPage' => $page, 146 'currentPage' => $page,
145 'tag' => $tag->getSlug(), 147 'tag' => $tag,
146 ]); 148 ]);
147 } 149 }
148} 150}