public function showByCategoryAction(Request $request, Category $category) { // Le manager des annonces $advertManager = $this->getAdvertManager(); $choices = null; $noRegionSelected = $this->get('session')->get('noRegionSelected'); $page_title = $category->getCategory(); if ($request->isMethod('post')) { $choices = $advertManager->recordChoiceFilter(); } else { $advertManager->removeChoiceSession(); } if ($noRegionSelected) { $localisation = null; } else { $localisation = $advertManager->getAdvertLocalisationSession(); } $user = $this->getUser(); $userFollow = false; if (is_object($user) || $user instanceof User) { $userFollow = $this->checkIfUserFollow($category); } $advertListToPaginate = $advertManager->getAdvertByCategory($category, $choices, $localisation); $advertList = $this->get('knp_paginator')->paginate($advertListToPaginate, $request->query->getInt('page', 1), 10); $breadcrumb = array(array($category->getCategory(), '#', true)); $requestRubriqueId = $category->getId(); return $this->getGlobalAdvertTemplating($advertList, $breadcrumb, $choices, $page_title, $localisation, $userFollow, $requestRubriqueId, $category->getId()); }