@@ -279,44 +279,44 @@ the following guidelines in mind while you develop.
279279
280280* **The order of the controller arguments does not matter **
281281
282- Symfony is able to match the parameter names from the route to the variable
283- names in the controller method's signature. In other words, it realizes that
284- the ``{lastName} `` parameter matches up with the ``$lastName `` argument.
285- The arguments of the controller could be totally reordered and still work
286- perfectly::
287-
288- public function indexAction($lastName, $color, $firstName)
289- {
290- // ...
291- }
282+ Symfony is able to match the parameter names from the route to the variable
283+ names in the controller method's signature. In other words, it realizes that
284+ the ``{lastName} `` parameter matches up with the ``$lastName `` argument.
285+ The arguments of the controller could be totally reordered and still work
286+ perfectly::
287+
288+ public function indexAction($lastName, $color, $firstName)
289+ {
290+ // ...
291+ }
292292
293293* **Each required controller argument must match up with a routing parameter **
294294
295- The following would throw a ``RuntimeException `` because there is no ``foo ``
296- parameter defined in the route::
295+ The following would throw a ``RuntimeException `` because there is no ``foo ``
296+ parameter defined in the route::
297297
298- public function indexAction($firstName, $lastName, $color, $foo)
299- {
300- // ...
301- }
298+ public function indexAction($firstName, $lastName, $color, $foo)
299+ {
300+ // ...
301+ }
302302
303- Making the argument optional, however, is perfectly ok. The following
304- example would not throw an exception::
303+ Making the argument optional, however, is perfectly ok. The following
304+ example would not throw an exception::
305305
306- public function indexAction($firstName, $lastName, $color, $foo = 'bar')
307- {
308- // ...
309- }
306+ public function indexAction($firstName, $lastName, $color, $foo = 'bar')
307+ {
308+ // ...
309+ }
310310
311311* **Not all routing parameters need to be arguments on your controller **
312312
313- If, for example, the ``lastName `` weren't important for your controller,
314- you could omit it entirely::
313+ If, for example, the ``lastName `` weren't important for your controller,
314+ you could omit it entirely::
315315
316- public function indexAction($firstName, $color)
317- {
318- // ...
319- }
316+ public function indexAction($firstName, $color)
317+ {
318+ // ...
319+ }
320320
321321.. tip ::
322322
0 commit comments