正確な配列を受け取ったことを確認できますが、このarray('question','type','type'=>'array','allowEmpty'=>false),
配列の中身はわかりません。配列要素を検証するには、次のようにする必要があります。
<?php
class TestForm extends CFormModel
{
public $ids;
public function rules()
{
return [
['ids', 'arrayOfInt', 'allowEmpty' => false],
];
}
public function arrayOfInt($attributeName, $params)
{
$allowEmpty = false;
if (isset($params['allowEmpty']) and is_bool($params['allowEmpty'])) {
$allowEmpty = $params['allowEmpty'];
}
if (!is_array($this->$attributeName)) {
$this->addError($attributeName, "$attributeName must be array.");
}
if (empty($this->$attributeName) and !$allowEmpty) {
$this->addError($attributeName, "$attributeName cannot be empty array.");
}
foreach ($this->$attributeName as $key => $value) {
if (!is_int($value)) {
$this->addError($attributeName, "$attributeName contains invalid value: $value.");
}
}
}
}