Symfony2寻呼机芬达

时间:2016-10-30 12:42:32

标签: php symfony pagerfanta

在symfony2中设置带有寻呼机fanta的路由/渲染控制器是否可行,因为我已经尝试渲染一个控制器并且它击中了我无法生成路径:

angular.module('app', []);
angular.module('app').directive('directive', function() {
    var directive = {};
    directive.restrict = 'AE';
    directive.scope = true;
    directive.link = function(scope, element, attrs) {      
        console.log(element)
    };
    return directive;
});

第27行我有

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.

2 个答案:

答案 0 :(得分:1)

试试这个

{{ pagerfanta(pager, 'twitter_bootstrap3', {'routeName': 'your_route_name'}) }}

答案 1 :(得分:0)

我不知道你如何使用WhiteOctoberPagerfantaBundle但你可以设置默认视图:https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle#adding-views。另请参阅此答案:Customising the layout of Pagerfanta pagination with a custom template

或者,pagerfanta函数接受第三个参数,其中包含用于创建路由生成器的选项。 https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle/blob/master/Twig/PagerfantaExtension.php#L100

值得注意的是,routeName可能足以满足您的需求:

{{ pagerfanta(pager, 'twitter_bootstrap3', {routeName: 'route_name'}) }}
相关问题