/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Viewers::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $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(['id' => $this->id, 'active' => $this->active, 'create_data' => $this->create_data, 'modified_dat' => $this->modified_dat]);
     $query->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'scales', $this->scales])->andFilterWhere(['like', 'init_extent', $this->init_extent])->andFilterWhere(['like', 'max_extent', $this->max_extent])->andFilterWhere(['like', 'projection', $this->projection])->andFilterWhere(['like', 'units', $this->units])->andFilterWhere(['like', 'author', $this->author])->andFilterWhere(['like', 'theme', $this->theme]);
     return $dataProvider;
 }
Esempio n. 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getViewer()
 {
     return $this->hasOne(Viewers::className(), ['id' => 'viewer_id']);
 }
Esempio n. 3
0
 /**
  * Finds the Viewers model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Viewers the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Viewers::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }