public static function getDropDown() { $items = GeoCountry::find()->asArray()->all(); $data = []; foreach ($items as $i) { $data[] = ['id' => $i['id'], 'name' => html_entity_decode($i['name'], ENT_COMPAT, 'UTF-8')]; } return $data; }
/** * @return \yii\db\ActiveQuery */ public function getCountry() { return $this->hasOne(GeoCountry::className(), ['id' => 'country_id']); }
public function run() { return Html::dropDownList($this->attribute, null, ArrayHelper::map(GeoCountry::getDropDown(), 'id', 'name')); }