Zend\Navigation doesn't work correct with Segment routes #4333

Closed
tomshaw opened this Issue Apr 26, 2013 · 4 comments

Projects

None yet

4 participants

Contributor
tomshaw commented Apr 26, 2013

I have two segment routes for two separate controller actions. When I access the category controller using the url http://zf2.dev/category/order/category_id/sort/asc/page/1 Move your mouse over the Zend Navigation generated link for the product route it reads. http://zf2.dev/product/order/category_id/sort/asc/page/1 when it should read http://zf2.dev/product.

            'category' => array(
                'type' => 'Segment',
                'options' => array(
                    'route' => '/category[/order/:order/sort/:sort/page/:page]',
                    'constraints' => array(
                        'page' => '[0-9]+',
                        'sort' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'order' => '[a-zA-Z][a-zA-Z0-9_-]*'
                    ),
                    'defaults' => array(
                        'controller' => 'Application\Controller\Category',
                        'action' => 'index',
                        'order' => 'id',
                        'sort' => 'asc',
                        'page' => 1
                    )
                )
            ),
            'product' => array(
                'type' => 'Segment',
                'options' => array(
                    'route' => '/product[/order/:order/sort/:sort/page/:page]',
                    'constraints' => array(
                        'page' => '[0-9]+',
                        'sort' => '[a-zA-Z][a-zA-Z0-9_-]*',
                        'order' => '[a-zA-Z][a-zA-Z0-9_-]*'
                    ),
                    'defaults' => array(
                        'controller' => 'Application\Controller\Product',
                        'action' => 'index',
                        'order' => 'id',
                        'sort' => 'asc',
                        'page' => 1
                    )
                )
            ),

My navigation.global.php

 array(
        'default' => array(
            'category' => array(
                'label' => 'Category Management',
                'title' => 'Category Management',
                'route' => 'category'
            ),
            'product' => array(
                'label' => 'Product Management',
                'title' => 'Product Management',
                'route' => 'product'
            )
        )
    )
);
@tomshaw tomshaw pushed a commit to tomshaw/zf2 that referenced this issue Apr 27, 2013
Tom Shaw Fixes matched routes from bubbling over to other segment routes. See …
…issue #4333
dd6b419
Contributor

@tomshaw since the PR was closed -> was this more a question or is this a problem?

Member

Duplicates #4195 (?)

Member

Any comments?

Member

@Ocramius
This issue is a duplicate.

@Ocramius Ocramius added the duplicate label Apr 4, 2014
@Ocramius Ocramius self-assigned this Apr 4, 2014
@Ocramius Ocramius closed this Apr 4, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment