Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
tomshaw opened this Issue · 4 comments

4 participants

Tom Shaw Martin Keckeis Frank Brückner Marco Pivetta
Tom Shaw

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'
            )
        )
    )
);
Tom Shaw tomshaw referenced this issue from a commit in tomshaw/zf2
Tom Shaw Fixes matched routes from bubbling over to other segment routes. See …
…issue #4333
dd6b419
Martin Keckeis

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

Frank Brückner

Duplicates #4195 (?)

Frank Brückner

Any comments?

Frank Brückner

@Ocramius
This issue is a duplicate.

Marco Pivetta Ocramius added the duplicate label
Marco Pivetta Ocramius self-assigned this
Marco Pivetta Ocramius closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.