填写php和yii2中的下拉菜单

I am trying to fill a drop-down menu with data from a query without success. I use the code bellow, how can I fix it?

<?= $form->field($model, 'plan_id')->dropDownList([

   yii\helpers\ArrayHelper::map(Yii::$app->db->createCommand('SELECT id,name FROM plans')
            ->queryAll(), 'id', 'name'),

   ['prompt' => 'Set plan'],
        'options'=>[$pl=>['Selected'=>true]]]);
?>

Seems you have a [] too much

  <?= $form->field($model, 'plan_id')->dropDownList(
        yii\helpers\ArrayHelper::map(Yii::$app->db->createCommand('SELECT id,name FROM plans')
          ->queryAll(), 'id', 'name'),
        ['prompt' => 'Set plan'],
        'options'=>[$pl=>['Selected'=>true]]);
  ?>

And you can also use ActiveRecord

  <?= $form->field($model, 'plan_id')->dropDownList(
        yii\helpers\ArrayHelper::map(Plans::find()->all(), 'id', 'name'),
        ['prompt' => 'Set plan'],
        'options'=>[$pl=>['Selected'=>true]]);
  ?>