I would like to use both type of session management in my application: filesystem and database session. So I’ve add in my protected/config/main.php components section:
'session' => array(
'class'=>'CHttpSession',
),
'sessiondb' => array(
'class'=>'CDbHttpSession',
'connectionID'=>'db',
),
Now, Yii::app()->sessiondb doesn’t work, in the sense that it doesn’t store data in YiiSession table. Moreover, YiiSession table is not created by default. Even if I create YiiSession table by hand, CDbHttpSession doesn’t store data in the table.
I’ve tried to add some data and print_r out , this is the result:
app()->sessiondb["foo"]="bar";
print_r(app()->sessiondb);
// below, the result:
CDbHttpSession Object
(
[connectionID] => db
[sessionTableName] => YiiSession
[autoCreateSessionTable] => 1
[_db:CDbHttpSession:private] =>
[autoStart] => 1
[behaviors] => Array
(
)
[_initialized:CApplicationComponent:private] => 1
[_e:CComponent:private] =>
[_m:CComponent:private] =>
)
If I comment ‘session’ part of that config, and rename ‘sessiondb’ in ‘session’ it works. It seems that you can work only with one type of session, filesystem OR database, not with both… and component must be named ‘session’ to work.
Any idea?
TIA
Danilo