diff options
Diffstat (limited to 'src/Wallabag/CoreBundle/Controller/EntryController.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Controller/EntryController.php | 42 |
1 files changed, 19 insertions, 23 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index dc399b8a..b73e9eec 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php | |||
@@ -102,6 +102,21 @@ class EntryController extends Controller | |||
102 | } | 102 | } |
103 | 103 | ||
104 | /** | 104 | /** |
105 | * Shows all entries for current user. | ||
106 | * | ||
107 | * @param Request $request | ||
108 | * @param int $page | ||
109 | * | ||
110 | * @Route("/all/list/{page}", name="all", defaults={"page" = "1"}) | ||
111 | * | ||
112 | * @return \Symfony\Component\HttpFoundation\Response | ||
113 | */ | ||
114 | public function showAllAction(Request $request, $page) | ||
115 | { | ||
116 | return $this->showEntries('all', $request, $page); | ||
117 | } | ||
118 | |||
119 | /** | ||
105 | * Shows unread entries for current user. | 120 | * Shows unread entries for current user. |
106 | * | 121 | * |
107 | * @param Request $request | 122 | * @param Request $request |
@@ -173,6 +188,10 @@ class EntryController extends Controller | |||
173 | $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); | 188 | $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); |
174 | break; | 189 | break; |
175 | 190 | ||
191 | case 'all': | ||
192 | $qb = $repository->getBuilderForAllByUser($this->getUser()->getId()); | ||
193 | break; | ||
194 | |||
176 | default: | 195 | default: |
177 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); | 196 | throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); |
178 | } | 197 | } |
@@ -201,29 +220,6 @@ class EntryController extends Controller | |||
201 | 'currentPage' => $page, | 220 | 'currentPage' => $page, |
202 | ) | 221 | ) |
203 | ); | 222 | ); |
204 | |||
205 | if ($request->query->has($form->getName())) { | ||
206 | // manually bind values from the request | ||
207 | $form->submit($request->query->get($form->getName())); | ||
208 | |||
209 | // build the query from the given form object | ||
210 | $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); | ||
211 | } | ||
212 | |||
213 | $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); | ||
214 | $entries = new Pagerfanta($pagerAdapter); | ||
215 | |||
216 | $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); | ||
217 | $entries->setCurrentPage($page); | ||
218 | |||
219 | return $this->render( | ||
220 | 'WallabagCoreBundle:Entry:entries.html.twig', | ||
221 | array( | ||
222 | 'form' => $form->createView(), | ||
223 | 'entries' => $entries, | ||
224 | 'currentPage' => $page, | ||
225 | ) | ||
226 | ); | ||
227 | } | 223 | } |
228 | 224 | ||
229 | /** | 225 | /** |