Yii Framework Forum: Check if the session has been already stored in the database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Check if the session has been already stored in the database Rate Topic: -----

#1 User is offline   Equ 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 27-November 09
  • Location:Russia, Moscow

Posted 22 June 2010 - 11:49 AM

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!
0

#2 User is offline   Giovanni D. 

  • Standard Member
  • PipPip
  • Yii
  • Group: Members
  • Posts: 238
  • Joined: 23-December 08
  • Location:London (UK)

Posted 25 June 2010 - 03:34 PM

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.
- Yii Playground: collaborative demo app with small examples to play with.. join us ;) [Fork on github]

- DeploYii: Yii powered task runner and deployment solution

- Social: LinkedIn ยท Twitter
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users