public function setUserByIdentity(IdentityInterface $identity)
    {
        $user = clone $this->getUser();
        $user->setIdentity($identity);
        $this->setUser($user);
    }
public function setUserByIdentity(IdentityInterface $identity)
    {
        $user = clone $this->getUser();
        $user->setIdentity($identity);
        $this->setUser($user);
    }
public function setUserByIdentity ( IdentityInterface $ identity ) { $ user = clone $ this -> getUser ( ) ; $ user -> setIdentity ( $ identity ) ; $ this -> setUser ( $ user ) ; }
Switch to user by identity
@param IdentityInterface $identity
@throws \yii\base\InvalidConfigException
Switch to user by identity