Hi
I am new to yii and currently reading definitive guide to yii.
i came across following code on Creating Model
what is the purpose of line
array('password', 'authenticate'),
? is it calling function authenticate?
if it is calling authenticate function, then what are the vaues for $attribute, $params?
thanks
class LoginForm extends CFormModel
{
public $username;
public $password;
public $rememberMe=false;
private $_identity;
public function rules()
{
return array(
array('username, password', 'required'),
array('rememberMe', 'boolean'),
array('password', 'authenticate'),
);
}
public function authenticate($attribute,$params)
{
$this->_identity=new UserIdentity($this->username,$this->password);
if(!$this->_identity->authenticate())
$this->addError('password','Incorrect username or password.');
}
}