コード例 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Estaticas::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]);
     $query->andFilterWhere(['like', 'titulo', $this->titulo])->andFilterWhere(['like', 'cuerpo', $this->cuerpo])->andFilterWhere(['like', 'opciones', $this->opciones]);
     return $dataProvider;
 }
コード例 #2
0
 /**
      //funcion que debuelve un registro determinado por su campo titulo*/
 protected function findModelE($id)
 {
     if (($model = Estaticas::find()->where(['titulo' => $id])->one()) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('La página especificada no existe!');
     }
 }