Reputation: 21739
I really need to use $this->Session->read('id')
in one of the model's method therefore I need to include Session component in the model. How can I do that? public $component = array('Session');
doesn't work like in the Controller.
Upvotes: 1
Views: 2750
Reputation: 687
For using session inside the custom component I tried with
public $components = array('Session');
and then called it by using
$this->Session->read('Auth.User.id');
Upvotes: 0
Reputation: 21743
the component should be and is limited to the controller.
but you can use the static access:
CakeSession::read('Auth.User.id')
etc
Upvotes: 6