Skip to content

Commit b336b3d

Browse files
committed
Reworded the docs about storing sessions in database
1 parent c7b6a03 commit b336b3d

File tree

6 files changed

+536
-368
lines changed

6 files changed

+536
-368
lines changed

_build/redirection_map

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,3 +479,5 @@
479479
/components/translation/custom_formats https://github.com/symfony/translation
480480
/components/translation/custom_message_formatter https://github.com/symfony/translation
481481
/components/routing https://github.com/symfony/routing
482+
/doctrine/pdo_session_storage /session/database
483+
/doctrine/mongodb_session_storage /session/database

doctrine/mongodb_session_storage.rst

Lines changed: 0 additions & 31 deletions
This file was deleted.

doctrine/pdo_session_storage.rst

Lines changed: 0 additions & 276 deletions
This file was deleted.

reference/configuration/framework.rst

Lines changed: 4 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1233,70 +1233,17 @@ The service id used for session storage. The ``session.storage`` service
12331233
alias will be set to this service id. This class has to implement
12341234
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface`.
12351235

1236+
.. _config-framework-session-handler-id:
1237+
12361238
handler_id
12371239
..........
12381240

12391241
**type**: ``string`` **default**: ``null``
12401242

12411243
The service id used for session storage. The default ``null`` value means to use
12421244
the native PHP session mechanism. Set it to ``'session.handler.native_file'`` to
1243-
let Symfony manage the sessions itself using files to store the session
1244-
metadata.
1245-
1246-
You can also configure the session handler with a DSN. For example:
1247-
1248-
.. configuration-block::
1249-
1250-
.. code-block:: yaml
1251-
1252-
# config/packages/framework.yaml
1253-
framework:
1254-
session:
1255-
# ...
1256-
handler_id: 'redis://localhost'
1257-
handler_id: '%env(REDIS_URL)%'
1258-
handler_id: '%env(resolve:DATABASE_URL)%'
1259-
handler_id: 'file://%kernel.project_dir%/var/sessions'
1260-
1261-
.. code-block:: xml
1262-
1263-
<!-- config/packages/framework.xml -->
1264-
<?xml version="1.0" encoding="UTF-8" ?>
1265-
<container xmlns="http://symfony.com/schema/dic/services"
1266-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
1267-
xmlns:framework="http://symfony.com/schema/dic/symfony"
1268-
xsi:schemaLocation="http://symfony.com/schema/dic/services
1269-
https://symfony.com/schema/dic/services/services-1.0.xsd
1270-
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
1271-
1272-
<framework:config>
1273-
<framework:session enabled="true"
1274-
handler-id="redis://localhost"
1275-
handler-id="%env(REDIS_URL)%"
1276-
handler-id="%env(resolve:DATABASE_URL)%"
1277-
handler-id="file://%kernel.project_dir%/var/sessions"/>
1278-
</framework:config>
1279-
</container>
1280-
1281-
.. code-block:: php
1282-
1283-
// config/packages/framework.php
1284-
$container->loadFromExtension('framework', [
1285-
'session' => [
1286-
// ...
1287-
'handler_id' => 'redis://localhost',
1288-
'handler_id' => '%env(REDIS_URL)%',
1289-
'handler_id' => '%env(resolve:DATABASE_URL)%',
1290-
'handler_id' => 'file://%kernel.project_dir%/var/sessions',
1291-
],
1292-
]);
1293-
1294-
.. versionadded:: 4.4
1295-
1296-
The option to configure the session handler with a DSN was introduced in Symfony 4.4.
1297-
1298-
If you prefer to make Symfony store sessions in a database read
1299-
:doc:`/doctrine/pdo_session_storage`.
1245+
let Symfony manage the sessions itself using files to store the session metadata.
1246+
You can also :doc:`store sessions in a database </session/database>`.
13001247

13011248
.. _name:
13021249

0 commit comments

Comments
 (0)