Example #1
0
 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;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCountry()
 {
     return $this->hasOne(GeoCountry::className(), ['id' => 'country_id']);
 }
Example #3
0
 public function run()
 {
     return Html::dropDownList($this->attribute, null, ArrayHelper::map(GeoCountry::getDropDown(), 'id', 'name'));
 }