Skip to content

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

Merged
merged 1 commit into from
Feb 1, 2014

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Jan 9, 2014

...e path

Q A
Doc fix? yes
New docs? no
Applies to all
Fixed tickets #3450

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
Copy link
Member

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 })

Copy link
Member

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.

Copy link
Member Author

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?

@mtrojanowski
Copy link
Contributor

👍

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.
Copy link
Member

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.

Copy link
Member

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)

@weaverryan
Copy link
Member

@xabbuh can you rebase please?

@xabbuh
Copy link
Member Author

xabbuh commented Jan 27, 2014

@weaverryan done

weaverryan added a commit that referenced this pull request Feb 1, 2014
clarify that optional placeholders can only be used at the end of a rout...
@weaverryan weaverryan merged commit e710186 into symfony:2.3 Feb 1, 2014
@weaverryan
Copy link
Member

Thanks @xabbuh!

@xabbuh xabbuh deleted the issue-3450 branch February 1, 2014 18:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants