/** * This function is used to return the data to the DepDrop widget * See more information on http://demos.krajee.com/widget-details/depdrop */ public function actionGetEfdivisionList() { $divisionList = []; $unitId = isset(Yii::$app->request->post('depdrop_all_params')['efproject-unit_id']) ? Yii::$app->request->post('depdrop_all_params')['efproject-unit_id'] : null; if ($unitId != null) { $efDivision = EfDivision::find()->where(['UNIT_ID' => $unitId])->all(); $divisionList = ArrayHelper::toArray($efDivision, ['app\\models\\EfDivision' => ['id' => 'DIVISION_ID', 'name' => 'DIVISION_NAME']]); } echo Json::encode(['output' => $divisionList, 'selected' => '']); }