1. Go to this page and download the library: Download vkr/pager-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/ */
vkr / pager-bundle example snippets
class MyParser implements VKR\PagerBundle\Interfaces\PageableInterface
{
private $em;
public function __construct(Doctrine\ORM\EntityManager $em)
{
$this->em = $em;
}
public function getNumberOfRecords(array $additionalArguments = [])
{
$allRecords = $this->em->getRepository('AppBundle:MyEntity')->findAll();
if (!$allRecords) {
return 0;
}
return sizeof($allRecords);
}
}
public function getNumberOfRecords(array $additionalArguments = [])
{
$query = "SELECT a FROM table1 a WHERE a.id IN ($additionalArguments['ids'])";
...
}
public function myControllerAction()
{
...
$additionalArguments = [
'ids' => [1,2,3]
];
$pagerProps = $pager->getPagerProps($parser, $request->getRequestUri(), $recordsPerPage, $additionalArguments);
...
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.