src/controllers/CountryController.php
public function actionList()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $searchModel = new SearchCountry();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        $dataProvider->setPagination(false);
        $dataProvider->getSort()->defaultOrder = ['name' => SORT_ASC];
        return ArrayHelper::map($dataProvider->getModels(), 'id', 'name');
    }
public function actionList()
    {
        Yii::$app->response->format = Response::FORMAT_JSON;
        $searchModel = new SearchCountry();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        $dataProvider->setPagination(false);
        $dataProvider->getSort()->defaultOrder = ['name' => SORT_ASC];
        return ArrayHelper::map($dataProvider->getModels(), 'id', 'name');
    }
Gets a json list of the countries in the database.

@return array