0

是否可以在 symfony2 中使用寻呼机 fanta 设置路由/渲染控制器,因为我已经尝试渲染控制器,但它却无法生成路由:

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.

在第 27 行我有

{{ pagerfanta(pager, 'twitter_bootstrap3') }}
4

2 回答 2

1

试试这样

{{ pagerfanta(pager, 'twitter_bootstrap3', {'routeName': 'your_route_name'}) }}
于 2016-10-30T12:51:18.023 回答
0

我不知道你是如何使用的,WhiteOctoberPagerfantaBundle但你可以设置你的默认视图:https ://github.com/whiteoctober/WhiteOctoberPagerfantaBundle#adding-views 。另请参阅此答案:使用自定义模板自定义 Pagerfanta 分页的布局

或者,该pagerfanta函数采用带有选项的第三个参数来创建路由生成器。https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle/blob/master/Twig/PagerfantaExtension.php#L100

值得注意routeName的是,您需要做的事情可能就足够了:

{{ pagerfanta(pager, 'twitter_bootstrap3', {routeName: 'route_name'}) }}
于 2016-10-30T12:55:23.750 回答