whiteoctober/Pagerfanta — pull request #65 by aferrandini (2012-11-29 12:12:38+00:00)
Title: Workaround for use Symfony2 route generator in Php 5.3

If the user wants to create a $routeGenerator like this:

```php
$routeGenerator = function ($page) {
$this->generateUrl('list_action', array('page' => $page));
};
```

This works on Php 5.4 but not in Php 5.3

The work around consist in generate previously the url with a dummy page like 'PF_PAGE_NUMBER' and replace it inside the routeGenerator function like this.

```php
/**
* @Route ("/page/{page}", name="list_action", requirements={"page"="PF_PAGE_NUMBER|\d+"})
*/
public function listAction($page) {

// ...
$pagerfanta = ...

// ...

$route = $this->generateUrl('list_action', array('page' => 'PF_PAGE_NUMBER'));
$routeGenerator = function ($page, $route = '') {
return strtr($route, array('PF_PAGE_NUMBER' => $page));
};
$view = new TwitterBootstrapView();
$paginator = $view->render($pagerfanta, $routeGenerator, array(
'route' => $route
));

// ...
```