In the Docs it shows how to get the named placeholders when using a closure and returning the response directly. But, how do you get access to the named placeholders when using controllers to return the response? There is no example of that in the docs.
I have searched, so please forgive me if this has been posted before.
@FvsJson That works, at least for me, when I return the response right there. But, not if I use a controller class. It errors with this message:
Unable to invoke the callable because no value was given for parameter 3 ($args)
That is with the route like this:
$route->get('/{lang}/dashboard', function ($request, $response, $args) {
$args['lang'];
DashboardController::class;
})->setName('dashboard');
and like this:
$route->get('/{lang}/dashboard', function ($request, $response, $args) {
[$args['lang'], DashboardController::class];
})->setName('dashboard');
I am nearly certain that neither of those are correct. And, I am also certain that I am doing something incorrectly and hopefully obvious to someone else.
$route->get('/{lang}/dashboard', DashboardController::class)->setName('dashboard'); // are you calling __invoke method in here?
otherwise the router doesnt know what to call here?
//ie
$route->get('/{lang}/dashboard', DashboardController::class . ':indexAction')->setName('dashboard');