Check if the session has been already stored in the database

What’s the best way to check if the session has been already stored in the database?

At the moment the only thing works for me is:




if(Yii::app()->session->count > 0) {

    // do something here

}



But it doesn’t seem to be the right way.

Any suggestion are greatly appreciated.

Thank you!

Hello,

not sure I’ve understood what you want to do… anyway if Yii::app()->session->getIsStarted() doesn’t do what you want, then I guess that the method you used with count() / getCount() is the best available… (btw… I’d prefer to use them as method instead of properties, but this is more personal taste than useful)

bye,

Giovanni.