Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 6691148

Browse files
committedMay 28, 2020
minor symfony#12325 Reworded the docs about storing sessions in database (javiereguiluz)
This PR was squashed before being merged into the 4.4 branch. Discussion ---------- Reworded the docs about storing sessions in database This is part of our ongoing effort to reword all Doctrine related docs. I'll summon the power of the Symfony community to review this: * @dkarlovi could you please review that the section about RedisSessionHandler is correct? Thanks! * @stof could you please review the section about relational databases? Related to symfony#12324. Thanks! * @alcaeus could you please review the section about MongoDB? I have some problems about the config needed to pass the MongoDB connection to MongoDBSessionHandler. Thanks! The file to review is the new file `session/database.rst`. Here's how it looks rendered: https://github.com/javiereguiluz/symfony-docs/blob/b2ef983b79110cff8f85abeeffe78aa18f6bf31a/session/database.rst Thank you all! Commits ------- 500d961 Reworded the docs about storing sessions in database
2 parents c7b6a03 + 500d961 commit 6691148

File tree

7 files changed

+612
-370
lines changed

7 files changed

+612
-370
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.rst

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,9 @@ Learn more
853853
doctrine/custom_dql_functions
854854
doctrine/dbal
855855
doctrine/multiple_entity_managers
856-
doctrine/pdo_session_storage
857-
doctrine/mongodb_session_storage
858856
doctrine/resolve_target_entity
859857
doctrine/reverse_engineering
858+
session/database
860859
testing/database
861860

862861
.. _`Doctrine`: https://www.doctrine-project.org/

‎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

‎session.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,8 @@ session metadata files:
121121
]);
122122
123123
Check out the Symfony config reference to learn more about the other available
124-
:ref:`Session configuration options <config-framework-session>`. Also, if you
125-
prefer to store session metadata in a database instead of the filesystem,
126-
check out this article: :doc:`/doctrine/pdo_session_storage`.
124+
:ref:`Session configuration options <config-framework-session>`. You can also
125+
:doc:`store sessions in a database </session/database>`.
127126

128127
Basic Usage
129128
-----------
@@ -219,7 +218,9 @@ More about Sessions
219218
.. toctree::
220219
:maxdepth: 1
221220

222-
/doctrine/pdo_session_storage
221+
session/sessions_directory
222+
session/avoid_session_start
223+
session/database
223224
session/locale_sticky_session
224225
session/php_bridge
225226
session/proxy_examples

‎session/database.rst

Lines changed: 600 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)
Please sign in to comment.