You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 16, 2021. It is now read-only.
implementations, commonly referred to as "Routers".
63
65
64
-
When handling an incoming request, the ChainRouter iterates over the configured Routers,
65
-
by their configured priority, until one of them is able to `match <http://api.symfony.com/2.1/Symfony/Component/Routing/RouterInterface.html#method_match>`_
66
-
the request and provide the request parameters.
66
+
When handling an incoming request, the ``ChainRouter`` iterates over the
67
+
configured routers, by their configured priority, until one of them is able to
68
+
:method:`Symfony\\Component\\Routing\\RouterInterface::match` the request and
69
+
provide the request parameters.
67
70
68
71
Routers
69
72
-------
70
73
71
74
The ``ChainRouter`` is incapable of, by itself, making any actual routing decisions.
72
75
Its sole responsibility is managing the given set of Routers, which are responsible for matching a request and determining its parameters.
73
76
74
-
You can easily create your own Routers by implementing
objects for a Request dynamically from a data source. Although it can be used
129
130
in other ways, the ``RouteProviderInterface``'s main goal is to be easily
130
131
implemented on top of Doctrine PHPCR ODM or a relational database,
@@ -137,8 +138,8 @@ to use when handling the current Request:
137
138
* Apply all ``RouteFilterInterface`` to filter down this collection
138
139
* Let the ``FinalMatcherInterface`` instance decide on the best match among the remaining ``Route`` instances and transform it into the parameter array.
139
140
140
-
RouteProviderInterface
141
-
""""""""""""""""""""""
141
+
``RouteProviderInterface``
142
+
""""""""""""""""""""""""""
142
143
143
144
Based on the ``Request``, the ``NestedMatcher`` will retrieve an ordered
144
145
collection of ``Route`` objects from the ``RouteProviderInterface``. The idea
@@ -148,28 +149,29 @@ later steps.
148
149
149
150
The underlying implementation of the ``RouteProviderInterface`` is not in the
150
151
scope of this bundle. Please refer to the interface declaration for more
151
-
information. For a functional example, see `RoutingExtraBundle <https://github.com/symfony-cmf/RoutingExtraBundle>`_.
152
+
information. For a functional example, see :doc:`../bundles/routing-extra`.
152
153
153
-
RouteFilterInterface
154
-
""""""""""""""""""""
154
+
``RouteFilterInterface``
155
+
""""""""""""""""""""""""
155
156
156
157
The ``NestedMatcher`` can apply user provided ``RouteFilterInterface`` implementations
157
158
to reduce the provided ``Route`` objects, e.g. for doing content negotiation.
158
159
It is the responsibility of each filter to throw the ``ResourceNotFoundException`` if
159
160
no more routes are left in the collection.
160
161
161
-
FinalMatcherInterface
162
-
"""""""""""""""""""""
162
+
``FinalMatcherInterface``
163
+
"""""""""""""""""""""""""
163
164
164
165
The ``FinalMatcherInterface`` implementation has to determine exactly one
165
166
Route as the best match or throw an exception if no adequate match could
166
-
be found. The default implementation uses the `UrlMatcher <http://api.symfony.com/2.1/Symfony/Component/Routing/Matcher/UrlMatcher.html>`_
167
-
of the Symfony Routing Component.
167
+
be found. The default implementation uses the
168
+
:class:`Symfony\\Component\\Routing\\Matcher\\UrlMatcher` of the Symfony
169
+
Routing Component.
168
170
169
171
.. _component-routing-enhancers:
170
172
171
173
Route Enhancers
172
-
^^^^^^^^^^^^^^^
174
+
...............
173
175
174
176
Optionally, and following the matching process, a set of ``RouteEnhancerInterface``
175
177
instances can be applied by the ``DynamicRouter``. The aim of these is to allow you to
@@ -179,7 +181,7 @@ example, to dynamically assign a controller or template to a ``Route`` or to
179
181
packed with the bundle, documentation can be found inside each class file.
180
182
181
183
Linking a Route with a Content
182
-
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
184
+
..............................
183
185
184
186
Depending on your application's logic, a requested url may have an associated
185
187
content from the database. Those Routes should implement the
@@ -199,7 +201,7 @@ route instance and put the provided name into _route_name.
199
201
All routes still need to extend the base class ``Symfony\Component\Routing\Route``.
200
202
201
203
Redirections
202
-
^^^^^^^^^^^^
204
+
............
203
205
204
206
You can build redirections by implementing the ``RedirectRouteInterface``.
205
207
It can redirect either to an absolute URI, to a named Route that can be
@@ -211,7 +213,6 @@ should implement your own logic to handle the redirection. For an example on
211
213
implementing that redirection under the full Symfony2 stack, refer to
212
214
:doc:`../bundles/routing-extra`.
213
215
214
-
215
216
Generating URLs
216
217
~~~~~~~~~~~~~~~
217
218
@@ -220,14 +221,13 @@ is also responsible for generating an URL from a Route and its parameters.
220
221
The ``ChainRouter`` iterates over its known routers until one of them is
221
222
able to generate a matching URL.
222
223
223
-
224
224
Apart from using ``RequestMatcherInterface`` or ``UrlMatcherInterface`` to
225
225
match a Request/URL to its corresponding parameters, the ``DynamicRouter``
226
226
also uses an ``UrlGeneratorInterface`` instance, which allows it to
227
227
generate an URL from a Route.
228
228
229
229
The included ``ProviderBasedGenerator`` extends Symfony2's default
0 commit comments