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]]]);
?>