ERROR_NONE و... ثابتهایی هستن که توی کلاس CUserIdentity تعریف شدن و به تنهای معنا ندارن و موقعی معنا پیدا میکنن که خودمون با کمک شرطهای مختلف، اونها رو چک کنیم. برای مثال، توی مدل LoginForm یک متد داریم به اسم login با کد زیر:
public function login()
{
if($this->_identity===null)
{
$this->_identity=new UserIdentity($this->username,$this->password);
$this->_identity->authenticate();
}
if($this->_identity->errorCode===UserIdentity::ERROR_NONE)
{
$duration=$this->rememberMe ? 3600*24*30 : 0; // 30 days
Yii::app()->user->login($this->_identity,$duration);
return true;
}
else
return false;
}
همونطور که میبینید، این متد داره خطا رو چک میکنه که اگه ERROR_NONE بود، لاگین انجام بشه.