Some times there is requirement to access session in cakephp Model.So to access the session we use this:
Example:
In cakePHP 2.3
App::uses('CakeSession', 'Model/Datasource');$selected_lang = CakeSession::read('Auth.User.lang_id');
In cakePHP 1.3:
App::import('Component', 'SessionComponent');$session = new SessionComponent();
To access other model we use like:
App::import('Model', 'UserDpAssociation');
$this->UserDpAssociation =& new UserDpAssociation();
Comments
Post a Comment