Answer the question
In order to leave comments, you need to log in
[[+content_image]]
Why is eachValidator not working?
Good afternoon,
Tell me about EachValidator in yii2.
I don’t understand how I can pass an array of my values \u200b\u200bto it?
Model
public function rules() {
return [
[['field'], 'each', 'in', 'range' => array_keys(static::getAttributes(['field']))]
];
}
Answer the question
In order to leave comments, you need to log in
3rd parameter of this rule "rule" - defines the validation rules, i.e.:
[['field'], 'each', 'rule' => ['in', 'range' => array_keys(static::getAttributes(['field']))]]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question