-
Notifications
You must be signed in to change notification settings - Fork 157
[WIP] Fix: Regular expression in route definition #462
[WIP] Fix: Regular expression in route definition #462
Conversation
773f2ca
to
000a674
Compare
In regard to this, it seems we've got a few more unresolved issues, see the reason for the failing test above: 1. There are more routes which would need the same constraints 'view-module' => [
'type' => 'Segment',
'options' => [
'route' => '/:vendor/:module',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'view',
],
// constraints required here
'constraints' => [
'vendor' => '[a-zA-Z][a-zA-Z0-9_-]*', // same regular expression required here
'module' => '', // some regular expression required here
],
],
], 'zf-module' => [
'type' => 'Segment',
'options' => [
'route' => '/module',
'defaults' => [
'controller' => Controller\IndexController::class,
'action' => 'index',
],
],
'may_terminate' => true,
'child_routes' => [
'list' => [
'type' => 'Segment',
'options' => [
'route' => '/list[/:owner]',
'constrains' => [ // should be constraints, by the way
'owner' => '[a-zA-Z][a-zA-Z0-9_-]*', // same regular expression required here
],
'defaults' => [
'action' => 'organization',
],
],
],
],
], 2. Yes, there is a user named Right here they are: h/t @gianarb |
also exist |
#444 (comment) covers the username format but i feel uncomfortable writing such regex everytime we need a username in the url 😃 |
True, here she is: https://github.com/module! |
don't not know really what you mean |
I would define constants containing the regular expressions, then refer to these constants in the route definitions to avoid duplication. |
👍 |
fae8ddf
to
a262856
Compare
a262856
to
25d4db7
Compare
This PR
constraints
instead ofconstrains
Follows #444.