Changes
Title
unchanged
Yii for beginners 2
Category
unchanged
Tutorials
Yii version
unchanged
1.1
Tags
unchanged
Yii,mvc,tutorial,beginner
Content
changed
[...]
2nd = defaultScope()
3rd = custom scope
17. Each validator (see Yii2)
------------------------------------
If you need the "each validator" (for validating array of values) which is available in Yii2, you
can paste this method to your model and use it as the validator. Do not forget to specify validation rules for the particular values as well! See examples below.
```php[...]
$this->addError($attribute, 'An error text');
}
```
This code can also be found in the documentation of [CValidator](https://www.yiiframework.com/doc/api/1.1/CValidator)