Hello All,
I am bit confused with the below approach . If you guys look at the getUser method , If I call this method from any action it always goes to the NULL condition ( always satisfies $this->_user === null condition) . For example if I call this method from view action and again from update action it var dumps the user twice ( Going to the NULL condition ) . I thought during the session it only satisfies the null condition only first time and only once and for the remaining requests it just picks the value from session and not by querying again database .
I believe this is same as Yii::app()->user->setState()
class WebUser extends CWebUser{
private $_user;
//get the logged user
function getUser(){
if( $this->isGuest )
return;
if( $this->_user === null ){
Yii::trace(CVarDumper::dumpAsString($this->_user), 'vardump');
$this->_user = User::model()->findByPk( $this->id );
}
return $this->_user;
}
}
Could some one clarify ?
Thanks
Yii FAN