@@ -321,42 +321,42 @@ Keep the following guidelines in mind while you develop.
321
321
322
322
#. **The order of the controller arguments does not matter **
323
323
324
- Symfony matches the parameter **names ** from the route to the variable
325
- **names ** of the controller. The arguments of the controller could be
326
- totally reordered and still work perfectly::
324
+ Symfony matches the parameter **names ** from the route to the variable
325
+ **names ** of the controller. The arguments of the controller could be
326
+ totally reordered and still work perfectly::
327
327
328
- public function indexAction($lastName, $firstName)
329
- {
330
- // ...
331
- }
328
+ public function indexAction($lastName, $firstName)
329
+ {
330
+ // ...
331
+ }
332
332
333
333
#. **Each required controller argument must match up with a routing parameter **
334
334
335
- The following would throw a ``RuntimeException `` because there is no
336
- ``foo `` parameter defined in the route::
335
+ The following would throw a ``RuntimeException `` because there is no
336
+ ``foo `` parameter defined in the route::
337
337
338
- public function indexAction($firstName, $lastName, $foo)
339
- {
340
- // ...
341
- }
338
+ public function indexAction($firstName, $lastName, $foo)
339
+ {
340
+ // ...
341
+ }
342
342
343
- Making the argument optional, however, is perfectly ok. The following
344
- example would not throw an exception::
343
+ Making the argument optional, however, is perfectly ok. The following
344
+ example would not throw an exception::
345
345
346
- public function indexAction($firstName, $lastName, $foo = 'bar')
347
- {
348
- // ...
349
- }
346
+ public function indexAction($firstName, $lastName, $foo = 'bar')
347
+ {
348
+ // ...
349
+ }
350
350
351
351
#. **Not all routing parameters need to be arguments on your controller **
352
352
353
- If, for example, the ``lastName `` weren't important for your controller,
354
- you could omit it entirely::
353
+ If, for example, the ``lastName `` weren't important for your controller,
354
+ you could omit it entirely::
355
355
356
- public function indexAction($firstName)
357
- {
358
- // ...
359
- }
356
+ public function indexAction($firstName)
357
+ {
358
+ // ...
359
+ }
360
360
361
361
.. tip ::
362
362
0 commit comments