@@ -279,44 +279,44 @@ the following guidelines in mind while you develop.
279
279
280
280
* **The order of the controller arguments does not matter **
281
281
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
+ }
292
292
293
293
* **Each required controller argument must match up with a routing parameter **
294
294
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::
297
297
298
- public function indexAction($firstName, $lastName, $color, $foo)
299
- {
300
- // ...
301
- }
298
+ public function indexAction($firstName, $lastName, $color, $foo)
299
+ {
300
+ // ...
301
+ }
302
302
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::
305
305
306
- public function indexAction($firstName, $lastName, $color, $foo = 'bar')
307
- {
308
- // ...
309
- }
306
+ public function indexAction($firstName, $lastName, $color, $foo = 'bar')
307
+ {
308
+ // ...
309
+ }
310
310
311
311
* **Not all routing parameters need to be arguments on your controller **
312
312
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::
315
315
316
- public function indexAction($firstName, $color)
317
- {
318
- // ...
319
- }
316
+ public function indexAction($firstName, $color)
317
+ {
318
+ // ...
319
+ }
320
320
321
321
.. tip ::
322
322
0 commit comments