title: Dynamic Checkbox List in Yii2
body: <p>So I'm trying to create a dynamic Checkbox List in Yii2.
  I'm trying to adept the work done <a href="https://stackoverflow.com/questions/28092502/how-to-generating-a-dropdown-list-in-yii2">here</a> but without success. As described there i should use the ArrayHelper.</p>
  <p>So first I am fetching the data (works)</p>
  <pre><code>$listData=ArrayHelper::map(EinsatzorteModel::find()-&gt;asArray()-&gt;all(),'id','location'); 
  </code></pre>
  <p>Output(shortend):</p>
  <pre><code>array(9) { 
     [1]=&gt; string(18) &quot;Region: Y&quot; 
     [2]=&gt; string(17) &quot;Region: X&quot;
  }
  </code></pre>
  <p>Now I'm trying to add it to a checkbox list:</p>
  <pre><code>&lt;?= $form   -&gt;field($model, 'locations[]')
             -&gt;checkboxList(
              [$listData]
             )-&gt;label('Regionen');
  ?&gt;
  </code></pre>
  <p>Which errors to:</p>
  <blockquote>
  <p>htmlspecialchars() expects parameter 1 to be string, array given</p>
  </blockquote>
  <p>Obviously its an Array, but shouldn't it fit anyway? The checkbosList expects parameters to be given as</p>
  <pre><code>'A' =&gt; 'Item A'
  </code></pre>
  <p>which actually should fit the format from the ArrayHelper.</p>
  <p>So where do I get it wrong?</p>