I have error:
method_exists() expects parameter 2 to be string, array given
site: http://test.koxu1996.linuxpl.info/site/login.html
SiteController:
$model=new UserForm('login');
// collect user input data
if(isset($_POST['UserForm']))
{
$model->attributes=$_POST['UserForm'];
// validate user input and redirect to the previous page if valid
if($model->validate() && $model->login())
$this->redirect(Yii::app()->user->returnUrl);
}
// display the login form
$this->render('login',array('model'=>$model));
UserForm:
<?php
class UserForm extends CFormModel {
public $id;
public $username;
public $password;
public $password_real;
public $email;
public $code;
public $activated;
public $activation_key;
public $reset_key;
public $name;
public $street;
public $house_number;
public $apartment_number;
public $city;
public $zip_code;
public $phone_number;
public $country;
public $province;
public $pesel;
public $register_time;
public $authorised_time;
public $edit_time;
public $saldo;
public $referer_id;
public $role;
//login
public $rememberMe;
private $_identity;
//register
public $repeat_password;
public $verifyCode;
public $terms;
//userEdit
//adminEdit
public function rules() {
return array(
//login
array(
array('username, password', 'required', 'on' => 'login'),
array('rememberMe', 'boolean', 'on' => 'login'),
array('password', 'authenticate', 'on' => 'login'),
//register
array('username, password_real, email, name, street, house_number, apartment_number, city, zip_code, phone_number, country, province, pesel, repeat_password, verifyCode, terms', 'on' => 'register'),
array('username', 'unique', 'className'=>'user', 'attributeName'=>'username', 'on' => 'register'),
array('email','email', 'on' => 'register'),
array('email', 'unique', 'className'=>'user', 'attributeName'=>'email', 'on' => 'register'),
array('activated','default','value'=>0,'setOnEmpty'=>false, 'on' => 'register'),
array('zip_code','match', 'pattern'=>'/^[0-9]{2}-?[0-9]{3}$/Du', 'message'=>'Niepoprawny format', 'on' => 'register'),
array('country, province', 'numerical', 'integerOnly'=>true, 'on' => 'register'),
array('pesel','pesel', 'on' => 'register'),
array('saldo','default','value'=>0,'setOnEmpty'=>false, 'on' => 'register'),
array('repeat_password', 'compare', 'compareAttribute'=>'password', 'on' => 'register'),
array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(), 'skipOnError'=>true, 'on' => 'register'),
array('terms', 'compare', 'compareValue' => true, 'message' => 'Musisz zaakceptować regulamin.', 'on' => 'register'),
//userEdit
array('email, name, street, house_number, apartment_number, city, zip_code, phone_number, country, province', 'on' => 'userEdit'),
array('zip_code','match', 'pattern'=>'/^[0-9]{2}-?[0-9]{3}$/Du', 'message'=>'Niepoprawny format', 'on' => 'userEdit'),
array('country, province', 'numerical', 'integerOnly'=>true, 'on' => 'userEdit'),
array('email','email', 'on' => 'userEdit'),
array('email', 'unique', 'className'=>'user', 'attributeName'=>'email', 'on' => 'userEdit'),
//adminEdit
array('password_real, email, name, street, house_number, apartment_number, city, zip_code, phone_number, country, province, pesel', 'on' => 'adminEdit'),
array('zip_code','match', 'pattern'=>'/^[0-9]{2}-?[0-9]{3}$/Du', 'message'=>'Niepoprawny format', 'on' => 'adminEdit'),
array('country, province', 'numerical', 'integerOnly'=>true, 'on' => 'adminEdit'),
array('email', 'email', 'on' => 'adminEdit'),
array('email', 'unique', 'className'=>'user', 'attributeName'=>'email', 'on' => 'adminEdit'),
array('pesel','pesel', 'on' => 'adminEdit'),
//lostPassword
array('email', 'required', 'on' => 'lostPassword'),
array('email', 'email', 'on' => 'lostPassword'),
array('email', 'checkEmail', 'on' => 'lostPassword'),
));
}
}
What’s wrong?