/** * Creates a new Applicant model. * If creation is successful, the browser will be redirected to the 'view' page. * @return mixed */ public function actionCreate() { $model1 = new Applicant(); $model2 = new Personal(); $model3 = new Academic(); if ($model1->load(Yii::$app->request->post()) && $model2->load(Yii::$app->request->post()) && $model3->load(Yii::$app->request->post()) && $model1->save() && $model2->save() && $model3->save()) { return $this->redirect(['view', 'id' => $model1->id]); } else { return $this->render('create', ['model1' => $model1, 'model2' => $model2, 'model3' => $model3]); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Academic::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'section' => $this->section, 'tel_no' => $this->tel_no]); $query->andFilterWhere(['like', 'location', $this->location])->andFilterWhere(['like', 'type', $this->type])->andFilterWhere(['like', 'hs_name', $this->hs_name])->andFilterWhere(['like', 'hs_add', $this->hs_add])->andFilterWhere(['like', 'principal', $this->principal])->andFilterWhere(['like', 'organization', $this->organization])->andFilterWhere(['like', 'position', $this->position]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getAcademic0() { return $this->hasOne(Academic::className(), ['id' => 'academic']); }
/** * Finds the Academic model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Academic the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Academic::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getAcademics() { return $this->hasMany(Academic::className(), ['location' => 'location']); }
/** * @return \yii\db\ActiveQuery */ public function getAcademics0() { return $this->hasMany(Academic::className(), ['organization' => 'org_name']); }