title: Yii2: model not loading array
body: <p>I am using the following (simple) code for a model to be used with a form in yii2:</p>
  
  <pre><code>class ChooseAgeCategoriesForm extends Model
  {
  
      public $ageCategories;
  
      /**
       * @return array the validation rules.
       */
      public function rules()
      {
          return [
              ['ageCategories', 'safe'],
              [['ageCategories'], 'each', 'rule' =&gt; ['integer']],
          ];
      }
  }
  </code></pre>
  
  <p>However, then trying to load the model like this:</p>
  
  <pre><code>$model = new ChooseAgeCategoriesForm();
  
  if ($model-&gt;load(Yii::$app-&gt;request-&gt;post())) {
          $acIDs = $model-&gt;ageCategories;
  }
  </code></pre>
  
  <p>The code is never executed. In fact, <code>$model-&gt;load</code> returns <code>Bool(false)</code> but <code>$model-&gt;errors</code> is empty. Dumping the content of <code>post</code> yields this result:</p>
  
  <pre><code>array(2) { ["_csrf"]=&gt; string(56) "SzhjdWIuc0oIQSA0BEs4BDp8KzYEXwM5CG80RhNBRDkPUzIXO1gBew==" ["ageCategories"]=&gt; array(9) { [0]=&gt; string(1) "1" [1]=&gt; string(1) "2" [2]=&gt; string(1) "3" [3]=&gt; string(1) "4" [4]=&gt; string(1) "5" [5]=&gt; string(1) "6" [6]=&gt; string(1) "7" [7]=&gt; string(1) "9" [8]=&gt; string(2) "10" } }
  </code></pre>
  
  <p>So yes, the field is actually sent and filled with an array of numbers. What don't I see here, what is the problem? Thanks in advance. I also tried to add <code>['ageCategories', 'exist', 'allowArray' =&gt; true],</code> as another rule, but this does not work either. Any ideas?</p>
  
  <p><strong>Form code</strong></p>
  
  <p>As requested, the code of the form itself:</p>
  
  <pre><code>&lt;?php $form = ActiveForm::begin([
      'action' =&gt; Url::to(['/result/team-result']),
      'method' =&gt; 'post',
      'options' =&gt; ['id' =&gt; 'chooseAgeCategory', 'style' =&gt; "margin-bottom: 15px;"]
  ]); ?&gt;
  
  &lt;?= Select2::widget([
      'name' =&gt; 'ageCategories',
      'id' =&gt; 'ac-id',
      'value' =&gt; $acIDs,
      'data' =&gt; ArrayHelper::map(AgeCategory::find()-&gt;all(), 'id', 'name'),
      'options' =&gt; ['multiple' =&gt; true, 'placeholder' =&gt; Yii::t('view', 'Select Age Category')],
      'pluginEvents' =&gt; [
          "change" =&gt; "function() { this.form.submit(); }",
      ]
  ]) ?&gt;
  
  &lt;?php $form-&gt;end(); ?&gt;
  </code></pre>