Closed ronald-hristov closed 7 years ago
you are aware that your constraint requires you to have at least 2 characters? and I expect the reason this doesn't work ik because the default.controller doesn't match the constraint either because there are no \
allowed in the constraint. Hope this helps if still relevant :D
It is not considered a good practice to use controller
placeholder. Declare explicit routes for each controller.
'application' => [
'type' => Literal::class,
'options' => [
'route' => '/app',
'defaults' => [
'controller' => Controller\AppController::class,
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'index' => [
'type' => Segment::class,
'options' => [
'route' => '/index[/:action]',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]+',
],
// defaults inherited
],
],
'foo' => [
'type' => Segment::class,
'options' => [
'route' => '/foo[/:action]',
'constraints' => [
'action' => '[a-zA-Z][a-zA-Z0-9_-]+',
],
'defaults' => [
'controller' => Controller\FooController::class,
],
],
],
],
],
In version 3.0.2 If I have the following Segment route
And use the the new InvokableFactory for the IndexController like this
Following the url /app/index/index will result in a
If I add this to the controllers part of the configuration
the url will be matched correctly (So basically the controller constraint is expecting the full namespace to the controller). But this doesn't look like a solution, because the 'index' key will be overwritten by another Module's Index controller invokable.