Add the submodule:
git submodule add git://github.com/uniplaces/PaginationBundle.git vendor/bundles/Uniplaces/PaginationBundle
Register the namespace in app/autoload.php:
'Uniplaces' => __DIR__.'/../vendor/bundles',
And finally add load the budle in the bundles list in app/AppKernel.php:
new Uniplaces\PaginationBundle\UniplacesPaginationBundle()
In your controller:
use Uniplaces\PaginationBundle\Paginator\Paginator;
use YourApp\YourBundle\Paginator\PageableObject;
$paginator = new Paginator(new PageableObject($queryObject), $currentPage);
return $this->render('UniplacesPaginationBundle:Default:test.html.twig', array('paginator' => $paginator));
In the view:
{{ paginate_widget(paginator, routeRoute, routeParameters) }}
The result:
<div class="pagination">
<ul>
<li><a href="/app.php/list"><< First</a></li>
<li><a href="/app.php/list">< Previous</a></li>
<li class="active"><a href="/app.php/list">1</a></li>
<li><a href="/app.php/list/2">2</a></li>
<li><a href="/app.php/list/3">3</a></li>
<li><a href="/app.php/list/4">4</a></li>
<li><a href="/app.php/list/5">5</a></li>
<li><a href="/app.php/list/6">6</a></li>
<li><a href="/app.php/list/7">7</a></li>
<li><a href="/app.php/list/8">Next ></a></li>
<li><a href="/app.php/list/123">Last >></a></li>
</ul>
</div>