Search code examples
phpsymfonyeasyadmin

Easy admin bundle: how to access parameter array of MenuItem::linktoRoute fourth parameter


in my DashboarController I add a link to one of my routes in the configureMenuItems() function like this: yield MenuItem::linktoRoute('Title', 'icon', 'my_index', ['key' => 'value']);. In my Controller I trie to access the parameter as usual like this:

/**
 * @Route("/my", name="my_")
 */
class OneController extends AbstractController
{
     /**
     * @Route("/{key}", name="index")
     */
    public function index(string $key): Response
    {
        return $this->render('my_index/index.html.twig', [
            'controller_name' => 'OneController',
            'key' => 'someKey'
        ]);
    }
}

But I get the error No route found for GET /my. Without using the parameter {key} I can call the page.

Can somebody help me how to access the parameter array of linktoRoute() ?

Thanks in advance!

UPDATE:

The solution is: bin/console cache:clear followed by bin/console cache:warmup then you can find the parameters as GET-Parameters...


Solution

  • The solution is: bin/console cache:clear followed by bin/console cache:warmup then you can find the parameters as GET-Parameters...