dpy83214 2015-12-04 14:59
浏览 19

ZF2 Paginator问题与儿童路线

In my application I want to add some simple pagination. Normal first level routes function without any problems but when I try to implement a paginator in a child route I get error messages. Don't know how to address my child route correctly.

I have following routes:

'queues' => array(
    'type' => 'Literal',
    'options' => array(
        'route'    => '/queues',
        'defaults' => array(
            'controller' => 'Mail\Controller\MailQueue',
            'action'     => 'index',
        ),
    ),
    'may_terminate' => true,
    'child_routes' => array(
        'show' => array(
            'type'    => 'Segment',
            'options' => array(
                'route' => '/show/:queue_id',
                'constraints' => array(
                    'queue_id' => '[0-9]+',
                ),
                'defaults' => array(
                    'action' => 'show',
                ),
            ),
        ),
    )
)

And here the paginationControl from the .phtml file to output the pagination html:

echo $this->paginationControl(
    // the paginator object
    $this->paginator,
    // the scrolling style
    'sliding',
    // the partial to use to render the control
    'partial/paginator.phtml',
    // the route to link to when a user clicks a control link
    array(
        'route' => 'queues/show/' . $this->queue->getId()
    )
);

Unfortunately, I get this error:

File:
/home/norbert/dev/holding/efeedback_mail/vendor/zendframework/zend-mvc/src/Router/Http/TreeRouteStack.php:322

Message:
Route with name "show" does not have child routes

When I try to give it the route without the slash:

array(
    'route' => 'queues/show', $this->queue->getId()
)

I get this segment error:

File:
/home/norbert/dev/holding/efeedback_mail/vendor/zendframework/zend-mvc/src/Router/Http/Segment.php:298

Message:
Missing parameter "queue_id"

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
    • ¥15 Vue3地图和异步函数使用
    • ¥15 C++ yoloV5改写遇到的问题
    • ¥20 win11修改中文用户名路径
    • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
    • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计
    • ¥70 PlayWright在Java上连接CDP关联本地Chrome启动失败,貌似是Windows端口转发问题
    • ¥15 帮我写一个c++工程
    • ¥30 Eclipse官网打不开,官网首页进不去,显示无法访问此页面,求解决方法
    • ¥15 关于smbclient 库的使用