Reputation: 1061
I'm using Symfony 1.4 and Doctrine 1.2. I need to get the session ID inside an action.
I'm using doctrine session storage and that works fine. I'm also using sfDoctrineGuardPlugin and am able to get and set session variables in the user according to recommended practice, using code like this:
$this->getUser()->setAttribute('variable_name', $value);
$value = $this->getUser()->getAttribute('variable_name');
But how do I get the session id of the current user?
Upvotes: 4
Views: 6891
Reputation: 4506
It seems like you can't access the sfStorage
from the user object. The sfSessionStorage
stores the user data in the session...
So the only way I currently see is calling the 'native' session_id()
.
If you want to it perfectly you should extends the sfSessionStorage
adding a method to retrieve the session id. Then assign this storage to the user, and you would be able to call $this->getUser()->getStorage()->getSessionId();
.
Upvotes: 4