Cakephp getting session variable in model without using Auth component -


i want session variables in model. im not using auth component. there alternate way ?

thanks binoy

you need use session helper do,

$this->session->write('key','value'); 

but comment states, you'll wanting set variable in model , use session write same value variable in model, rather accessing session in model.

class mymodel extends appmodel{   var $username;   var $password; } 

then in controller use along lines of,

$this->mymodel->username = $this->session->read('user.id'); $this->mymodel->password = $this->session->read('user.password'); 

Comments

Popular posts from this blog

ruby - When to use an ORM (Sequel, Datamapper, AR, etc.) vs. pure SQL for querying -

php - PHPDoc: @return void necessary? -

c++ - Convert big endian to little endian when reading from a binary file -