![]() |
|
Snippets |
|
<?php class mySessionStorage extends sfMySQLSessionStorage { public function initialize ($context, $parameters = null) { session_set_cookie_params ( 90*24*3600 , "/", ".domain.tld" ); parent::initialize($context, $parameters); } } ?>
Then you have to put in factories.yml
all:
storage:
class: mySessionStorage
param:
database: ...
db_table: session
db_id_col: sess_id
db_data_col: sess_data
db_time_col: sess_time
session_name: ...
Comments on this snippet
Great Idea. Is there an sf session storage object that isn't MySQL specific? I was thinking about DB abstraction....
Paul: http://www.symfony-project.com/snippets/7
Thanks Fabien. I should have read a couple of snippets earlier. :-)
I guess what I was thinking about was a sfSessionStorage which would abstract all of those db specific session storage objects.
It's not specific to MysqlSessionStorage, you can use any other SessionStorage with this.
Hi, this class go in mySessionStorage.class.php in [app]/lib/, right? I extend sfCreoleSessionStorage, modify the factories.yml ( class: mySessionStorage ) but I've got this error:
Fatal error: Call to a member function getNamespaces() on a non-object in /usr/share/php/symfony/debug/sfDebug.class.php on line 98
I had the same problem that #5 Marco Barberis had. Attempting this again after a couple months I noticed the error has been fixed now (1.0.0-beta4). Looking through the source I noticed there were some new parameters set up for the session storage class that lets you specify parameters from the factories.yml file, eliminating the need for a custom session class to just set the path.
http://www.symfony-project.com/snippets/snippet/137