common/components/Core.php
public function getAppUser() {

		$cookieName = '_app-user';
		$appUser	= null;
		$user		= Yii::$app->user->identity;

		if( $user != null ) {

			$appUser = $user;
		}
		else if( isset( $_COOKIE[ $cookieName ] ) ) {

			$data = unserialize( $_COOKIE[ $cookieName ] );

			if( isset( $data[ 'user' ] ) ) {

				//$appUser = (object) $data[ 'user' ]['user'];

				$appUser = UserService::findById( $data[ 'user' ][ 'id' ] );
			}
		}

		return $appUser;
	}
public function getAppUser() {

		$cookieName = '_app-user';
		$appUser	= null;
		$user		= Yii::$app->user->identity;

		if( $user != null ) {

			$appUser = $user;
		}
		else if( isset( $_COOKIE[ $cookieName ] ) ) {

			$data = unserialize( $_COOKIE[ $cookieName ] );

			if( isset( $data[ 'user' ] ) ) {

				//$appUser = (object) $data[ 'user' ]['user'];

				$appUser = UserService::findById( $data[ 'user' ][ 'id' ] );
			}
		}

		return $appUser;
	}
public function getAppUser ( ) { $ cookieName = '_app-user' ; $ appUser = null ; $ user = Yii :: $ app -> user -> identity ; if ( $ user != null ) { $ appUser = $ user ; } else if ( isset ( $ _COOKIE [ $ cookieName ] ) ) { $ data = unserialize ( $ _COOKIE [ $ cookieName ] ) ; if ( isset ( $ data [ 'user' ] ) ) { //$appUser = (object) $data[ 'user' ]['user']; $ appUser = UserService :: findById ( $ data [ 'user' ] [ 'id' ] ) ; } } return $ appUser ; }
Call setAppUser at least once for new user before calling this method.
Call setAppUser at least once for new user before calling this method .