[['cities'], 'each', 'rule' => ['required','integer']],
['cities', function ($attribute, $params, $validator) {
if(is_array($this->$attribute)) {
if(empty($this->$attribute)) {
$this->addError($attribute, 'The array shouldnt be empty');
}
foreach($this->$attribute as $item) {
if(!is_int($item)) {
$this->addError($attribute, 'The array contains not an integer values');
break;
}
}
}
}], [
['cities', 'each', 'rule' => ['required']],
['cities', 'each', 'rule' => ['integer']],
]иначе yii ругается что не может найти такое поле cities[]