3.0 - Paginator&自定义路由问题

时间:2015-03-26 23:15:11

标签: php cakephp pagination cakephp-3.0

我试图在3.0中使用内置的paginator helper;它正在抛出“失踪的路线”#39;例外...

路线代码:

Router::prefix('manage', function ($routes) {
    $routes->connect('/:organizationNeedle',['controller'=>'Organizations','action' => 'dashboard']);
    $routes->connect('/:organizationNeedle/:controller',['action' => 'index']);
    $routes->connect('/:organizationNeedle/:controller/:action/*');
});

查看模板代码:

<?php echo $this->Paginator->numbers(); ?>

结果:

当前连接的路线都不匹配给定的URL或参数。添加匹配的路线到config\routes.php

传递的上下文是:

[
    '_base' => '',
    '_port' => '80',
    '_scheme' => 'http',
    '_host' => 'vlife.v4',
    'params' => [
        'plugin' => null,
        'controller' => 'Containers',
        'action' => 'index',
        '_ext' => null,
        'pass' => [],
        'organizationNeedle' => 'test',
        'prefix' => 'manage',
        'paging' => [
            'Containers' => [
                [maximum depth reached]
            ]
        ]
    ]
]

我尝试了几种不同路由的组合,但找不到不会抛出此错误的路由。如果我将$routes->fallbacks('DashedRoute');添加到我的路线信息中,它不会再引发错误;生成的链接指向/manage/*controller*?page=2而不是正确的/manage/*organization*/*controller*?page=2

0 个答案:

没有答案