Skip to content

Commit 35e4457

Browse files
committed
[#7322] some minor tweaks
1 parent b418615 commit 35e4457

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

controller.rst

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,8 @@ cookie by using native PHP sessions.
346346

347347

348348
.. versionadded:: 3.3
349-
The ability to request a ``Session`` in actions was introduced in Symfony 3.3.
349+
The ability to request a ``Session`` instance in controllers was introduced
350+
in Symfony 3.3.
350351

351352
To retrieve the session, add the :class:`Symfony\\Component\\HttpFoundation\\Session\\SessionInterface`
352353
type-hint to your argument and Symfony will provide you with a session::
@@ -372,18 +373,6 @@ Stored attributes remain in the session for the remainder of that user's session
372373
Every ``SessionInterface`` implementation is supported. If you have your
373374
own implementation, type-hint this in the arguments instead.
374375

375-
As a developer, you might prefer not to extend the ``Controller``. To use the
376-
flash message functionality, you can request the flash bag from the
377-
:class:`Symfony\\Component\\HttpFoundation\\Session\\Session`::
378-
379-
use Symfony\Component\HttpFoundation\Session\Session;
380-
381-
public function indexAction(Session $session)
382-
{
383-
// getFlashBag is not available in the SessionInterface and requires the Session
384-
$flashBag = $session->getFlashBag();
385-
}
386-
387376
.. index::
388377
single: Session; Flash messages
389378

@@ -418,6 +407,20 @@ For example, imagine you're processing a :doc:`form </forms>` submission::
418407
return $this->render(...);
419408
}
420409

410+
.. tip::
411+
412+
As a developer, you might prefer not to extend the ``Controller``. To
413+
use the flash message functionality, you can request the flash bag from
414+
the :class:`Symfony\\Component\\HttpFoundation\\Session\\Session`::
415+
416+
use Symfony\Component\HttpFoundation\Session\Session;
417+
418+
public function indexAction(Session $session)
419+
{
420+
// getFlashBag is not available in the SessionInterface and requires the Session
421+
$flashBag = $session->getFlashBag();
422+
}
423+
421424
After processing the request, the controller sets a flash message in the session
422425
and then redirects. The message key (``notice`` in this example) can be anything:
423426
you'll use this key to retrieve the message.

controller/argument_value_resolver.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Functionality Shipped with the HttpKernel
1818
.. versionadded:: 3.3
1919
The ``SessionValueResolver`` was introduced in Symfony 3.3.
2020

21-
Symfony ships with four value resolvers in the HttpKernel component:
21+
Symfony ships with five value resolvers in the HttpKernel component:
2222

2323
:class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver`
2424
Attempts to find a request attribute that matches the name of the argument.

0 commit comments

Comments
 (0)