PHP code example of mangati / paginator-bundle
1. Go to this page and download the library: Download mangati/paginator-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mangati / paginator-bundle example snippets
// app controller
/**
* @Route("/", name="my_index_route")
*/
public function index(Request $request, PaginatorFactory $paginatorFactory)
{
$qb = $this
->getDoctrine()
->getManager()
->createQueryBuilder()
->select('e', 's')
->from(Entity::class, 'e');
$query = $qb->getQuery();
$paginator = $paginatorFactory
->withExtraParams(['q'])
->create(
$request,
$query,
'my_index_route'
);
return $this->render('index.html.twig', [
'paginator' => $paginator,
]);
}