Wrong route matched with same sub name

52 views Asked by At

here is my menu class.

public function createShopAdminMenu()
{
    $menu = $this->factory
        ->createItem('root')
        ->setChildrenAttribute('class', 'nav nav-pills')
    ;

    $menu->addChild('Administration', ['route' => 'admin_dashboard', 'extras' => [ 'safe_label' => true ]]);

    $products = $menu
        ->addChild('Products', ['route' => 'shop_admin_product', 'extras' => [ 'safe_label' => true ]])
        ->setDisplayChildren(false)
    ;
    $products->addChild('Create', ['route' => 'shop_admin_product_form']);

    return $menu;
}

And this is the template where I'm using the menu.

{{ knp_menu_render('shop_admin', { 'allow_safe_labels': true, 'currentClass': 'active', 'ancestorClass': 'active' }) }}

This is my routing table (as overview!).

Routes

And here is the screenshot how it look.

enter image description here

Then the bug / problem with the subroute(s).

enter image description here

You can see... Both are active. That's bad. I dont know why. I think because the voter or something marks the /admin as current because the others starts with /admin.

Thanks in Advance for ideas!

0

There are 0 answers