@@ -10,7 +10,7 @@ class::
1010
1111 class LeapYearController
1212 {
13- public function indexAction ($request)
13+ public function index ($request)
1414 {
1515 if (is_leap_year($request->attributes->get('year'))) {
1616 return new Response('Yep, this is a leap year!');
@@ -99,39 +99,39 @@ following interface::
9999 public function getArguments(Request $request, $controller);
100100 }
101101
102- The ``indexAction () `` method needs the Request object as an argument.
102+ The ``index () `` method needs the Request object as an argument.
103103``getArguments() `` knows when to inject it properly if it is type-hinted
104104correctly::
105105
106- public function indexAction (Request $request)
106+ public function index (Request $request)
107107
108108 // won't work
109- public function indexAction ($request)
109+ public function index ($request)
110110
111111More interesting, ``getArguments() `` is also able to inject any Request
112112attribute; the argument just needs to have the same name as the corresponding
113113attribute::
114114
115- public function indexAction ($year)
115+ public function index ($year)
116116
117117You can also inject the Request and some attributes at the same time (as the
118118matching is done on the argument name or a type hint, the arguments order does
119119not matter)::
120120
121- public function indexAction (Request $request, $year)
121+ public function index (Request $request, $year)
122122
123- public function indexAction ($year, Request $request)
123+ public function index ($year, Request $request)
124124
125125Finally, you can also define default values for any argument that matches an
126126optional attribute of the Request::
127127
128- public function indexAction ($year = 2012)
128+ public function index ($year = 2012)
129129
130130Let's just inject the ``$year `` request attribute for our controller::
131131
132132 class LeapYearController
133133 {
134- public function indexAction ($year)
134+ public function index ($year)
135135 {
136136 if (is_leap_year($year)) {
137137 return new Response('Yep, this is a leap year!');
0 commit comments