Closed shishi666 closed 7 years ago
That's out of this library's control.
Think that routing helper methods in tha app object (like get
, post
, put
and such) are factory methods that create and register routes.
Those methods return a new Expressive Route object, but updating that object once it has been registered won't affect the registered route, because internally, the Slim router has a Slim Route instance that's not tied with that object in any way.
If you need to set route options while working with a programmatic approach like this, you have to set the options while registering the route, like this.
$route = new Zend\Expressive\Router\Route('/', App\Action\HomePageAction::class, 'GET', 'home');
$route->setOptions([
'defaults' => [
'test' => 'test',
]
]);
$app->route($route);
Thanks for your explanations
I'm happy to help :)
Hello,
I try to use expressive-slim-router in my expressive v2 application.
I create a modular expressive application with zend-service-manager, plates-renderer and whoops.
I add this dependencies in my composer.json and i update dependencies.
And i change my config/autoload/router.global.php :
Then i modify config/routes.php like this :
Finally when I var_dump Routes I can not see options...
Have you an idea to help me?
Thanks in advance