Yii v2 snippet guide

Comparing #205 with #206

Revision #206 was created by rackycz rackycz on Jun 30, 2020, 11:22:08 PM.

FK DropDown

Content

[...]
$currencies = ArrayHelper::map($currencies, 'id', 'name');

<?= $form->field($model, 'id_currency')->dropDownList($currencies) ?>
```

Note: In other views
you will need models with predefined relations to reach the correct value. Relations can be created using GII (when they are defined in MySQLDB) or [manually](https://www.yiiframework.com/doc/guide/2.0/en/db-active-record#relational-data).