/** * 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' => '']); }
/** * @return \yii\db\ActiveQuery */ public function getDIVISION() { return $this->hasOne(EfDivision::className(), ['DIVISION_ID' => 'DIVISION_ID']); }
/** * @return \yii\db\ActiveQuery */ public function getEfDivisions() { return $this->hasMany(EfDivision::className(), ['UNIT_ID' => 'UNIT_ID']); }