class Users extends ActiveRecord
{
public $verifyCode;
public $newPassword;
public $verifyPassword;
public $ban;
public $carName;
public $carSerialNumber;
public $carCategory;
public $carVolume;
public $carX;
public $carY;
public $carZ;
public $carCorpus;
public $carCapacity;
public $carBrands;
public $photo;
public $pictures;
public $imagePath = 'images/users';
...
public function rules()
{
return
[
['name', 'required'],
[['role_id', 'email', 'place_id'], 'required', 'on'=>['registrationCustomer','registrationDriver']], // registration
[['telephone'], 'required', 'on'=>['registrationCustomer','registrationDriver','update']],
[['password'], 'required', 'on'=>['registrationCustomer','registrationDriver','password']],
// регистрация
['password', 'compare', 'compareAttribute'=>'verifyPassword', 'on'=>['registrationCustomer','registrationDriver']],
// обновление пароля
['newPassword', 'compare', 'compareAttribute'=>'verifyPassword', 'on'=>['password']],
['verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements(), 'on'=>['registrationCustomer','registrationDriver']],[['carBrands','carCorpus','carName','carSerialNumber','carCategory','carVolume'],'required','on'=>['registrationDriver']], // ,'carX','carY','carZ' 'carCapacity',
['email', 'email'],
['email', 'unique'],
['role_id, ban, category_id, sys_date, sys_date_update, sys_user, exist', 'numerical', 'integerOnly'=>true],
['skype, icq, name, email', 'length', 'max'=>255],
['password', 'length', 'max'=>32],
['verifyPassword, newPassword', 'safe'],
[['telephone'], 'match', 'pattern'=>'/^(\+?\d+)?\s*(\(\d+\))?[\s-]*([\d-]*)$/'],
['id, name, role_id, email, password, telephone, sys_date, sys_date_update, sys_user, exist', 'safe', 'on'=>'search'],
[['photo','pictures'], 'file', 'types' => 'jpg, png, gif', 'allowEmpty' => true],
[['carBrands','carCorpus','carCapacity','carName','carSerialNumber','carCategory'],'safe'],
[['carX','carY','carZ', 'carVolume'], 'match', 'pattern'=>'/([0-9][0-9]*?)(\.[0-9]{2})?/'],
[['carName','carSerialNumber'],'length', 'max'=>255],
[['carBrands','carCorpus','carCategory'], 'numerical', 'integerOnly'=>true], // ,'carCapacity'
];
}
...
if(!$model->validate())
echo 'Ошибка валидации';
else
echo 'Хорошо все';
if(!$model->save())
var_dump($model->getErrors());
<?php $form=$this->beginWidget('CActiveForm',
[
'id'=>'users-form',
'enableAjaxValidation' => true,
'enableClientValidation'=>true,
'clientOptions'=>
[
'validateOnSubmit'=>true,
],
'htmlOptions' =>
[
'enctype' => 'multipart/form-data'
],
]);
?>
<?php echo $form->errorSummary($model); ?>
$form->errorSummaryБ.сщвуЮ
не вышло. В чем может быть моя ошибка <b>array(0) { }</b>?