Esempio n. 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = DcmdCommand::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['cmd_id' => $this->cmd_id, 'task_id' => $this->task_id, 'subtask_id' => $this->subtask_id, 'svr_pool_id' => $this->svr_pool_id, 'cmd_type' => $this->cmd_type, 'state' => $this->state, 'utime' => $this->utime, 'ctime' => $this->ctime, 'opr_uid' => $this->opr_uid]);
     $query->andFilterWhere(['like', 'svr_pool', $this->svr_pool])->andFilterWhere(['like', 'svr_name', $this->svr_name])->andFilterWhere(['like', 'ip', $this->ip])->andFilterWhere(['like', 'err_msg', $this->err_msg]);
     return $dataProvider;
 }
 /**
  * Finds the DcmdCommand model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return DcmdCommand the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = DcmdCommand::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }