Difference between #205 and #206 of
Yii v2 snippet guide

Revision #206 has been created by rackycz on Jun 30, 2020, 11:22:08 PM with the memo:

FK DropDown
« previous (#205) next (#207) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
$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).
7 0
4 followers
Viewed: 274 888 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history