//error:: htmlspecialchars() expects parameter 1 to be string, object given
//desc:: kartik Select2 expects date from getAllCountries() to in a certain format i dont understand
//view
<?= Select2::widget([
'name' => 'country_code',
'data' => Country::getAllCountries(),
'options' => [
'id' => 'country_select',
'multiple' => false,
'placeholder' => 'Choose...',
'class' =>
' uk-width-medium-7-10']
]);
?>
<?=
//Country model
/**
* @return \yii\db\ActiveQuery
*/
public function getAllCountries()
{
return Country::find()->orderby('country_name')->all();
}
?>