I have a problem with my paginate. My route :
show_product_category:
path: /{id}/{name}
defaults: { _controller: ShopDesktopBundle:Category:showCategory}
requirements:
id: d+
_method: GET
In my controller :
$aProducts = $repositoryProduct->getProductsOrderByDateDesc($id);
$paginator = $this->get('knp_paginator');
$pagination = $paginator->paginate(
$aProducts,
$this->get('request')->query->get('page', 1),
3
);
return $this->render('ShopDesktopBundle:Category:category.html.twig',array(
'pagination' => $pagination
));
I view :
<div class="navigation">
{{ knp_pagination_render(pagination) }}
</div>
It's calculate normal the count of products and in view I see : 1 2 3 >.
But when I tried to get the page 2 in url it's send : ?page=2 but the list of products not change.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…