I'm using knp-paginator and I have a controller
public function offers(Request $request)
{
$locations= $this->getDoctrine()->getRepository(Oobject::class)->findAll();
$paginator = $this->get('knp_paginator');
dump(get_class($paginator));
$result = $paginator->paginate(
$locations,
$request->query->getInt('page', 1),
$request->query->getInt('limit', 3)
);
return $this->render('main/offers.html.twig', array
('controller_name' => 'MainController',
'locations' =>$result)
);
}
Everything works as expected until I add pagination into html.twig file like so:
<div>
{{knp_pagination_render(locations)}}
</div>
I get an error "There are no registered paths for namespace "KnpPaginator"." Any idea how to fix this?
I fixed it by adding this path in
twig.yamlfile: