Skip to content
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

clarify the routing component documentation a bit #6023

Merged
merged 1 commit into from
Jan 10, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions components/routing/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,15 @@ URL path and some array of custom variables in its constructor. This array
of custom variables can be *anything* that's significant to your application,
and is returned when that route is matched.

If no matching route can be found a
:class:`Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException` will be thrown.
The :method:`UrlMatcher::match() <Symfony\\Component\\Routing\\UrlMatcher::match>`
returns the variables you set on the route as well as the wildcard placeholders
(see below). Your application can now use this information to continue
processing the request. In addition to the configured variables, a ``_route``
key is added, which holds the name of the matched route.

In addition to your array of custom variables, a ``_route`` key is added,
which holds the name of the matched route.
If no matching route can be found, a
:class:`Symfony\\Component\\Routing\\Exception\\ResourceNotFoundException` will
be thrown.

Defining Routes
~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -126,6 +130,9 @@ In this case, the route is matched by ``/archive/2012-01``, because the ``{month
wildcard matches the regular expression wildcard given. However, ``/archive/foo``
does *not* match, because "foo" fails the month wildcard.

When using wildcards, these are returned in the resulting array of calling
``match``. The part of the path that the wildcard matched is used as value.

.. tip::

If you want to match all URLs which start with a certain path and end in an
Expand Down