Skip to content

Commit d68202f

Browse files
committed
Added more config formats
1 parent c1051db commit d68202f

File tree

1 file changed

+27
-7
lines changed

1 file changed

+27
-7
lines changed

session/database.rst

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,34 @@ First, define a Symfony service for the connection to the Redis server:
4646
Now pass this Redis connection as an argument of the service associated to the
4747
:class:`Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler`:
4848

49-
.. code-block:: yaml
49+
.. configuration-block::
5050

51-
# config/services.yaml
52-
services:
53-
# ...
54-
Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler:
55-
arguments:
56-
- '@Redis'
51+
.. code-block:: yaml
52+
53+
# config/services.yaml
54+
services:
55+
# ...
56+
Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler:
57+
arguments:
58+
- '@Redis'
59+
60+
.. code-block:: xml
61+
62+
<!-- config/services.xml -->
63+
<services>
64+
<service id="Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler">
65+
<argument type="service" id="Redis"/>
66+
</service>
67+
</services>
68+
69+
.. code-block:: php
70+
71+
// config/services.php
72+
use Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler;
73+
74+
$container
75+
->register(RedisSessionHandler::class)
76+
->addArgument(new Reference('Redis'));
5777
5878
Next, use the :ref:`handler_id <config-framework-session-handler-id>`
5979
configuration option to tell Symfony to use this service as the session handler:

0 commit comments

Comments
 (0)