Reputation: 53
I'm using CakePHP 2.0, and tries to configure it to store sessions in a database.
However, I find the official documentation very unclear. I understand I need to set the following in core.php:
<?php
Configure::write('Session', array(
'defaults' => 'database',
'handler' => array(
'model' => 'CustomSession'
)
));
I've created the table with cake's schema:
CREATE TABLE cake_sessions (
id varchar(255) NOT NULL default '',
data text,
expires int(11) default NULL,
PRIMARY KEY (id)
);
It still doesn't work. Do I need to create the session model by myself? If so, how?
Upvotes: 1
Views: 5062
Reputation: 434
Since you have created the model in the core file as cake_sessions, you will need to name your table as cake_sessions. cake_session is the default model
<?php
Configure::write('Session', array(
'defaults' => 'database',
'handler' => array(
'model' => 'cake_sessions'
)
));
Upvotes: 2