@@ -417,10 +417,6 @@ front controller - see :ref:`page-creation-environments`).
417417You'll want to customize the error page your user sees. To do that, see
418418the :doc: `/controller/error_pages ` article.
419419
420- .. index ::
421- single: Controller; The session
422- single: Session
423-
424420.. _controller-request-argument :
425421
426422The Request object as a Controller Argument
@@ -443,13 +439,61 @@ object. To get it in your controller, just add it as an argument and
443439:ref: `Keep reading <request-object-info >` for more information about using the
444440Request object.
445441
442+ .. index ::
443+ single: Controller; The session
444+ single: Session
445+
446+ .. _session-intro :
447+
446448Managing the Session
447449--------------------
448450
449451Symfony provides a nice session object that you can use to store information
450452about the user between requests. By default, Symfony stores the token in a
451453cookie and writes the attributes to a file by using native PHP sessions.
452454
455+ First, enable sessions in your configuration:
456+
457+ .. configuration-block ::
458+
459+ .. code-block :: diff
460+
461+ # config/packages/framework.yaml
462+ framework:
463+ # ...
464+
465+ + session:
466+ + # With this config, PHP's native session handling is used
467+ + handler_id: ~
468+
469+ .. code-block :: xml
470+
471+ <!-- config/packages/framework.xml -->
472+ <?xml version =" 1.0" encoding =" UTF-8" ?>
473+ <container xmlns =" http://symfony.com/schema/dic/services"
474+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
475+ xmlns : framework =" http://symfony.com/schema/dic/symfony"
476+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
477+ http://symfony.com/schema/dic/services/services-1.0.xsd
478+ http://symfony.com/schema/dic/symfony
479+ http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
480+
481+ <framework : config >
482+ <!-- ... -->
483+ <framework : session handler-id =" null" />
484+ </framework : config >
485+ </container >
486+
487+ .. code-block :: php
488+
489+ // config/packages/framework.php
490+ $container->loadFromExtension('framework', array(
491+ 'session' => array(
492+ // ...
493+ 'handler_id' => null,
494+ ),
495+ ));
496+
453497 To retrieve the session, add the :class: `Symfony\\ Component\\ HttpFoundation\\ Session\\ SessionInterface `
454498type-hint to your argument and Symfony will provide you with a session::
455499
@@ -474,6 +518,8 @@ Stored attributes remain in the session for the remainder of that user's session
474518 Every ``SessionInterface `` implementation is supported. If you have your
475519 own implementation, type-hint this in the arguments instead.
476520
521+ For more info, see :doc: `/session `.
522+
477523.. index ::
478524 single: Session; Flash messages
479525
0 commit comments