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

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

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -