Storing sessions in DB in Symfony 1.4 sfPDOSessionStorage

Set up storing sessions in the database, here is the config:

storage:<br> class: sfPDOSessionStorage<br> param:<br> db_table: sf_sessions<br> database: doctrine<br> db_id_col: sess_id<br> db_data_col: sess_data<br> db_time_col: sess_time<br>

All anything, but it sfUser->setFlash() session is reset, or rather all session attributes when you try to access the methods sfuser get fatal with the explanation that the invoked method is non-existent object.

Who faced or can share insight? How to configure storing sessions in the database in Symfony?
October 8th 19 at 01:29
1 answer
October 8th 19 at 01:31
I do not remember what the reason was... since right now I use 2 version of Symphony... but in old projects were so

storage:<br> class: mySessionStorage<br> param:<br> session_name: soccer<br> db_table: session<br> database: main<br> regenerate: false

The class itself mySessionStorage.php

<?php<br--> /**<br> * Adds option for turning off regenerate session id<br> *<br> * <b>parameters:</b> see sfSessionStorage<br> *<br> * @package symfony<br> * @subpackage storage<br> * @author Mathew Toth <developer@poetryleague.com><br> * @author Fabien Potencier <fabien.potencier@symfony-project.com><br> * @author Sean Kerr <sean@code-box.org><br> * @author Sergei Miami <miami@blackcrystal.net><br> * @version SVN: $Id$<br> */<br> class mySessionStorage extends sfPDOSessionStorage<br> {<br> public function initialize($options = array())<br> {<br> // add 'regenerate' option, that is true by default in symfony<br> $options = array_merge(array(<br> 'regenerate' => true,<br> ), $options);<br> <br / > // initialize the parent<br> parent::initialize($options);<br> }<br> <br / > public function regenerate($destroy = false)<br> {<br> if ( (bool) $this->options['regenerate'] === true)<br> {<br> return parent::regenerate($destroy);<br> }<br> }<br> <br / > }</miami@blackcrystal.net></sean@code-box.org></fabien.potencier@symfony-project.com></developer@poetryleague.com>
gorgeous ) try - Madge.Wehner commented on October 8th 19 at 01:34

Find more questions by tags SymfonyPHP