Skip to content
This repository has been archived by the owner on Apr 14, 2023. It is now read-only.

Migration Session Handler to convert Symfony session table from version 2.5 to version 2.6 and up

License

Notifications You must be signed in to change notification settings

offerista/migration-pdo-session-handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

migration-pdo-session-handler

Migration Session Handler to convert Symfony session table from version 2.5 to version 2.6 and up.

Background

Upgrade to Symfony 2.6 contains a breaking change. https://github.com/symfony/symfony/blob/v2.6.0/UPGRADE-2.6.md#httpfoundation symfony/symfony#12833 It is said that you would need to migrate the table manually if you want to keep session information of your users. With this package there is no need to migrate your session information manually.

Installation

Install this package with composer:

composer.phar require marktjagd/migration-pdo-session-handler

Configuration

  • Rename old session table. Example for mysql:
RENAME TABLE session TO session_legacy
  • configure your Symfony project:
# config.yml

framework:
    session:
        handler_id: session.handler.pdo_migration
# services.yml

services:
    session.handler.pdo_migration:
        class:     Marktjagd\Session\Storage\Handler\MigrationPdoSessionHandler
        arguments:
            - @session.handler.pdo_legacy
            - @session.handler.pdo_session

    session.handler.pdo_legacy:
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler\LegacyPdoSessionHandler
        arguments: [@pdo, %pdo.legacy_session_db_options%]

    session.handler.pdo:
        class:     Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler
        arguments: [@pdo, %pdo.session_db_options%]

parameters:
    pdo.legacy_session_db_options:
        db_table:    session_legacy
        db_id_col:   session_id
        db_data_col: session_value
        db_time_col: session_time

    pdo.session_db_options:
        db_table:    session
        db_id_col:   session_id
        db_data_col: session_data
        db_lifetime_col: session_lifetime
        db_time_col: session_time

About

Migration Session Handler to convert Symfony session table from version 2.5 to version 2.6 and up

Resources

License

Stars

Watchers

Forks

Packages

No packages published