File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,18 @@ Stored attributes remain in the session for the remainder of that user's session
376
376
Every ``SessionInterface `` implementation is supported. If you have your
377
377
own implementation, type-hint this in the arguments instead.
378
378
379
+ As a developer, you might prefer not to extend the ``Controller ``. To use the
380
+ flash message functionality, you can request the flash bag from the
381
+ :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ Session `::
382
+
383
+ use Symfony\Component\HttpFoundation\Session\Session;
384
+
385
+ public function indexAction(Session $session)
386
+ {
387
+ // getFlashBag is not available in the SessionInterface and requires the Session
388
+ $flashBag = $session->getFlashBag();
389
+ }
390
+
379
391
.. index ::
380
392
single: Session; Flash messages
381
393
You can’t perform that action at this time.
0 commit comments