How to set value in array helper Yii2?

Viewed 1341

I want to set value of array helper in Yii 2 as id (primary key of database). But when I use it shows me 0,1,2,3,.. not its real id number.

Here is my array helper code:

<?= Html::activeDropDownList($model, 'username',
  array_merge(array(''=>' '), ArrayHelper::map(Experts::find()->all(), 'id', 'username'))) ?>

How can I access real value of primary id??

When I use other parameter it works correctly but when I use id it shows number from 0 to up : |

1 Answers
Related