0

Is it posible to set the route / render controller with pager fanta in symfony2 because i have tried rendering a controller and it hits me with cannot generate route:

An exception has been thrown during the rendering of a template ("Unable to generate a URL for the named route "" as such route does not exist.") in @AppBundle\Survey\table_questions.html.twig at line 27.

On line 27 i have

{{ pagerfanta(pager, 'twitter_bootstrap3') }}
martin
  • 93,354
  • 25
  • 191
  • 226
L.S
  • 399
  • 1
  • 5
  • 19

2 Answers2

1

try like this

{{ pagerfanta(pager, 'twitter_bootstrap3', {'routeName': 'your_route_name'}) }}
Bogdan
  • 693
  • 7
  • 26
0

I don't know how exactly you use the WhiteOctoberPagerfantaBundle but you can set your default view: https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle#adding-views. Also see this answer: Customising the layout of Pagerfanta pagination with a custom template.

Alternatively, the pagerfanta function takes a third argument with options to create the route generator. https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle/blob/master/Twig/PagerfantaExtension.php#L100.

Notably routeName might be enough for what you need to do:

{{ pagerfanta(pager, 'twitter_bootstrap3', {routeName: 'route_name'}) }}
Community
  • 1
  • 1
martin
  • 93,354
  • 25
  • 191
  • 226
  • actually it worked with routeName only because i have defaults for page. but you gave me more info that i needed :D – L.S Oct 30 '16 at 12:58