/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EmpStatus::find()->where(['is_status' => 0]); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['emp_status_id' => SORT_DESC]]]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['emp_status_id' => $this->emp_status_id, 'created_at' => $this->created_at, 'created_by' => $this->created_by, 'updated_at' => $this->updated_at, 'updated_by' => $this->updated_by, 'is_status' => $this->is_status]); $query->andFilterWhere(['like', 'emp_status_name', $this->emp_status_name])->andFilterWhere(['like', 'emp_status_description', $this->emp_status_description]); unset($_SESSION['exportData']); $_SESSION['exportData'] = $dataProvider; return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getEmpMasterStatus() { return $this->hasOne(EmpStatus::className(), ['emp_status_id' => 'emp_master_status_id']); }
/** * Finds the EmpStatus model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return EmpStatus the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = EmpStatus::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }