/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Atcinfo::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(['isworked' => $this->isworked, 'id' => $this->id, 'port' => $this->port, 'lastSync' => $this->lastSync]); $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'dbms', $this->dbms])->andFilterWhere(['like', 'server', $this->server])->andFilterWhere(['like', 'username', $this->username])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'database', $this->database])->andFilterWhere(['like', 'lastUniqueid', $this->lastUniqueid]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getAtc() { return $this->hasOne(Atcinfo::className(), ['id' => 'atcid']); }
/** * Finds the Atcinfo model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Atcinfo the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Atcinfo::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }