I am using FOSUserBundle to manage users, and sessions are saved in database thanks to PdoSessionStorage.
I would like to add fields in my session table :
- user_id : which is a foreign key referencing the ID of logged user
- ip : IP address of the user logged in
- end_time : the time when the user has logged out
Here is my app/config/config.yml file :
framework:
session:
default_locale: %locale%
auto_start: true
lifetime: 72000
storage_id: session.storage.pdo
parameters:
pdo.db_options:
db_table: session
db_id_col: session_id
db_data_col: value
db_time_col: time
services:
doctrine.dbal.default.wrapped_connection:
factory_service: doctrine.dbal.default_connection
factory_method: getWrappedConnection
class: PDO
session.storage.pdo:
class: Symfony\Component\HttpFoundation\SessionStorage\PdoSessionStorage
arguments: [@doctrine.dbal.default.wrapped_connection, %session.storage.options%, %pdo.db_options%]
How can I do that ?
Do I need to extend PdoSessionStorage class ?
If so, how to do this ?