Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MetaBase::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_meta' => $this->id_meta, 'sitemap' => $this->sitemap, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'hash', $this->hash])->andFilterWhere(['like', 'route', $this->route])->andFilterWhere(['like', 'robots_index', $this->robots_index])->andFilterWhere(['like', 'robots_follow', $this->robots_follow])->andFilterWhere(['like', 'author', $this->author])->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'keywords', $this->keywords])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'h1_title', $this->h1_title])->andFilterWhere(['like', 'infotext_before', $this->infotext_before])->andFilterWhere(['like', 'infotext_after', $this->infotext_after])->andFilterWhere(['like', 'sitemap_change_freq', $this->sitemap_change_freq])->andFilterWhere(['like', 'sitemap_priority', $this->sitemap_priority]);
     return $dataProvider;
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function beforeSave($insert)
 {
     $this->hash = md5($this->route);
     $this->first_keyword = mb_strtolower($this->getFirstKeyword());
     return parent::beforeSave($insert);
 }