Skip to content

Added a mention to the createTable() method of the session handler #9104

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions doctrine/pdo_session_storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ a second array argument to ``PdoSessionHandler``:
The ``db_lifetime_col`` was introduced in Symfony 2.6. Prior to 2.6,
this column did not exist.

These are parameters that you must configure:
These are parameters that you can configure:

``db_table`` (default ``sessions``):
The name of the session table in your database;
Expand Down Expand Up @@ -216,8 +216,18 @@ Preparing the Database to Store Sessions
----------------------------------------

Before storing sessions in the database, you must create the table that stores
the information. The following sections contain some examples of the SQL statements
you may use for your specific database engine.
the information. The session handler provides a method called
:method:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\Handler::createTable`
to set up this table for you according to the database engine used::

try {
$sessionHandlerService->createTable();
} catch (\PDOException $e) {
// the table could not be created for some reason
}

If you prefer to set up the table yourself, these are some examples of the SQL
statements you may use according to your specific database engine.

.. _pdo-session-handle-26-changes:

Expand Down