/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = TestResults::find(); // add conditions that should always apply here $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; } // grid filtering conditions $query->andFilterWhere(['ID' => $this->ID, 'HEADER_ID' => $this->HEADER_ID, 'TEST_ID' => $this->TEST_ID, 'TIMEOFTEST' => $this->TIMEOFTEST]); $query->andFilterWhere(['like', 'TESTNAME', $this->TESTNAME])->andFilterWhere(['like', 'MINRANGE', $this->MINRANGE])->andFilterWhere(['like', 'RESULT', $this->RESULT])->andFilterWhere(['like', 'MAXRANGE', $this->MAXRANGE])->andFilterWhere(['like', 'UNITS', $this->UNITS])->andFilterWhere(['like', 'TESTSTATUS', $this->TESTSTATUS])->andFilterWhere(['like', 'GRAPH_ID', $this->GRAPH_ID])->andFilterWhere(['like', 'TEST_TYPE', $this->TEST_TYPE])->andFilterWhere(['like', 'X_AXIS', $this->X_AXIS])->andFilterWhere(['like', 'Y_AXIS', $this->Y_AXIS]); return $dataProvider; }
/** * Finds the TestResults model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return TestResults the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = TestResults::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Displays a single GlobalTest model. * @param string $id * @return mixed */ public function actionView($id) { // $resultModel = new TestResultsSearch(); // $resultModel = $resultModel::findAll(['HEADER_ID' => $id]); $query = TestResults::find()->where(['HEADER_ID' => $id])->orderBy(['TEST_ID' => SORT_ASC]); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100]]); // $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('view', ['model' => $this->findModel($id), 'dataProvider' => $dataProvider]); }