-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
clarify that optional placeholders can only be used at the end of a rout... #3452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
that everything after the first optional placeholder can be omitted in | ||
a request. Otherwise your route will never match if the optional placeholder | ||
is not given. For example, in the example above it was not possible to | ||
move the ``{page}}`` placeholder before the ``/blog`` part of the route |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{page}
(you had a double }
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and maybe using {_locale}
is a more real use-case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right. But I'd then change the whole example. Otherwise, the example in the note would be rather unrelated to the example described in this chapter. What do you think?
👍 |
a request. Otherwise your route will never match if the optional placeholder | ||
is not given. For example, in the example above it was not possible to | ||
move the ``{page}`` placeholder before the ``/blog`` part of the route | ||
path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this, but maybe we can make it shorter by having more examples. Like:
Of course, you can have more than one optional placeholder (e.g. ``/blog/{slug}/{page}``),
but everything after an optional placeholder must be optional. For example, ``/{{page}}/blog``
is a valid path, but ``page`` will always be required (i.e. simply ``/blog`` will not match
this route).
What do you think? It's kind of a trick explanation, that needs to be done quickly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for your proposal (except that /{{page}}/blog
is Twig syntax, it should be /{page}/blog
)
@xabbuh can you rebase please? |
@weaverryan done |
clarify that optional placeholders can only be used at the end of a rout...
Thanks @xabbuh! |
...e path