You don't have to create a model for session table due to CDbHttpSession relies on PDO to access database
.
What is the configuration of your session component?
You specify session ID and start the session manually by calling open() method. This method sets session callback methods using PHP's session_set_save_handler function. readSession($id) is among them and according to session_set_save_handler
's manual page:
This callback is called internally by PHP when the session starts or when session_start() is called.
Due to session_start creates a session or resumes the current one
you have to grant that session is not started automatically before setting session's identifier. autoStart property of Yii's session instance is responsible for that and must be set to false
(defaults to true
).
Also an indentifier connectionID of your database connection to retrieve session data through must be specified. It's important, otherwise:
If not set, a SQLite database will be automatically created and used.
Keeping it all in mind I suppose that configuration of your session component must look like:
'session' => array(
'class' => 'CDbHttpSession',
'autoStart' => false,
'connectionID' => 'db',
'sessionTableName' => 'your_session_table_name',
'autoCreateSessionTable' => false // for performance reasons
)