dropDownlist

<?= $form->field($model, ‘promotion_id’)->dropDownList(ArrayHelper::map(\backend\models\Promotions::find()->all(), ‘id’, ‘name’)) ?>. It is a drop down list in my form. Here the name field shows name of the promotions i have created. but i want to add an additional field because i have duplicate names in my table. For example now i get options as 25% to 50% more than 1 time. so i want it like 25% to 50% - location as choices. please help me.

This returns an array in which the keys are 'id’s and the values are corresponding 'name’s, something like:




[

    1 => 'some promotion',

    2 => 'some promotion',

    3 => 'other promotion',

    ...

]



So, you just have to make an array something like this:




[

    1 => 'some promotion (25%)',

    2 => 'some promotion (50%)',

    3 => 'other promotion (25%)',

    ...

]