/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Docworkflow::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->joinWith('document')->joinWith(['userReceive' => function ($q) { $q->from('user receive'); }])->joinWith('docStatus')->joinWith(['userRelease' => function ($q) { $q->from('user release'); }]); //$query->joinWith('document')->joinWith('userRelease')->joinWith('userReceive'); $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(['timeAccepted' => $this->timeAccepted, 'timeRelease' => $this->timeRelease]); $query->andFilterWhere(['like', 'docWorkflowComment', $this->docWorkflowComment])->andFilterWhere(['like', 'totalTimeSpent', $this->totalTimeSpent])->andFilterWhere(['like', 'document.documentName', $this->document_id])->andFilterWhere(['like', 'receive.userLName', $this->user_receive])->andFilterWhere(['like', 'docstatus.docStatusName', $this->docStatus_id])->andFilterWhere(['like', 'docworkflow.id', $this->id])->andFilterWhere(['like', 'release.userLName', $this->user_release]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getDocworkflows() { return $this->hasMany(Docworkflow::className(), ['docStatus_id' => 'id']); }
/** * Finds the Docworkflow model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Docworkflow the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Docworkflow::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
protected function findModelWorkflow($workflowid) { if (($workflow1 = Docworkflow::findOne($workflowid)) !== null) { return $workflow1; } else { throw new NotFoundHttpException('The requested page does not exist. Go back to previous page.'); } }