Skip to content

Commit aa85609

Browse files
richardmiller-zzweaverryan
authored andcommitted
Reiterated that Request can be passed to controller methods in scope article
1 parent 27a34ba commit aa85609

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

‎cookbook/service_container/scopes.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,14 @@ The service config for this class would look something like this:
193193
Injecting the whole container into a service is generally not a good
194194
idea (only inject what you need). In some rare cases, like when working
195195
with Twig extensions, its necessary to due a shortcoming in Twig itself.
196+
197+
If you define a controller as a service then you can get a `Request` object
198+
without injecting the container by having it passed in as an argument of your
199+
action method::
200+
201+
use Symfony\Component\HttpFoundation\Request;
202+
203+
public function updateAction(Request $request)
204+
{
205+
// ...
206+
}

0 commit comments

Comments
 (0)