From 2b7a4889178b35b64e0297d12abef79dd0b70df4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20L=C5=93uillet?= Date: Fri, 21 Aug 2015 07:38:18 +0200 Subject: filters: adapt queryBuilder for 'all' view --- .../CoreBundle/Controller/EntryController.php | 33 ++++------------------ 1 file changed, 5 insertions(+), 28 deletions(-) (limited to 'src/Wallabag/CoreBundle/Controller') diff --git a/src/Wallabag/CoreBundle/Controller/EntryController.php b/src/Wallabag/CoreBundle/Controller/EntryController.php index 4070a603..c4975ae6 100644 --- a/src/Wallabag/CoreBundle/Controller/EntryController.php +++ b/src/Wallabag/CoreBundle/Controller/EntryController.php @@ -113,34 +113,7 @@ class EntryController extends Controller */ public function showAllAction(Request $request, $page) { - $form = $this->get('form.factory')->create(new EntryFilterType()); - - $filterBuilder = $this->getDoctrine() - ->getRepository('WallabagCoreBundle:Entry') - ->findAllByUser($this->getUser()->getId()); - - if ($request->query->has($form->getName())) { - // manually bind values from the request - $form->submit($request->query->get($form->getName())); - - // build the query from the given form object - $this->get('lexik_form_filter.query_builder_updater')->addFilterConditions($form, $filterBuilder); - } - - $pagerAdapter = new DoctrineORMAdapter($filterBuilder->getQuery()); - $entries = new Pagerfanta($pagerAdapter); - - $entries->setMaxPerPage($this->getUser()->getConfig()->getItemsPerPage()); - $entries->setCurrentPage($page); - - return $this->render( - 'WallabagCoreBundle:Entry:entries.html.twig', - array( - 'form' => $form->createView(), - 'entries' => $entries, - 'currentPage' => $page, - ) - ); + return $this->showEntries('all', $request, $page); } /** @@ -215,6 +188,10 @@ class EntryController extends Controller $qb = $repository->getBuilderForUnreadByUser($this->getUser()->getId()); break; + case 'all': + $qb = $repository->getBuilderForAllByUser($this->getUser()->getId()); + break; + default: throw new \InvalidArgumentException(sprintf('Type "%s" is not implemented.', $type)); } -- cgit v1.2.3