Creates data provider instance with search query applied
@param array $params
@return ActiveDataProvider
342315
public function search($params)
    {//echo __METHOD__;var_dump($params);
        $this->load($params);//var_dump($this->titleMinLength);var_dump($this->title);var_dump($this->body);

        $modelNewsClassname = $this->module->model('News')->className();
        $query = $this->module->model('NewsQuery', [$modelNewsClassname]);//var_dump($query);exit;

        $query->orderBy(['show_from_time' => SORT_DESC]);

        //$query->alias('main')->leftJoin(['i18n' => NewsI18n::tableName()], "main.id = i18n.news_id AND i18n.lang_code = '{$this->langCodeMain}'");

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!$this->validate()) {
            $query->where('0=1'); // uncomment this line if you do not want to return any records when validation fails
            return $dataProvider;
        }

        // required criterias
        $query->where(['is_visible' => true]);

        $tzShiftSec = intval(date('Z')); // server time zone shift in seconds: west UTC <0, east UTC >0
        if (!empty($tzShiftSec)) {
            $now = new Expression("DATE_SUB(NOW(), INTERVAL {$tzShiftSec} SECOND)"); // UTC time
        }
        $query->andWhere(['<=', 'show_from_time', $now])
              ->andWhere(['or',
                  ['>=', 'show_to_time', $now],
                  ['show_to_time' => null],
                  //new Expression("show_to_time IS NULL"), //?? ['show_to_time' => null],
              ]);
        // no news for current language
/*
        $query->andWhere(['not', ['title' => null]]);
        $query->andWhere(['not', ['body'  => null]]);
        $query->andWhere(['not', ['title' => ''  ]]);
        $query->andWhere(['not', ['body'  => ''  ]]);
*/
        $query->andWhere(['and',
          ['not', ['title' => null]],
          ['not', ['body'  => null]],
          ['not', ['title' => ''  ]],
          ['not', ['body'  => ''  ]],
        ]);
        if (isset($this->titleMinLength)) {
            //$lengthExpr = new Expression("LENGTH(title)"); //! length in bytes, not UTF8-symbols
            $lengthExpr = new Expression("CHAR_LENGTH(title)");
            $query->andFilterWhere(['>=', $lengthExpr, $this->titleMinLength]);
        }
        if (isset($this->bodyMinLength)) {
            //$lengthExpr = new Expression("LENGTH(body)"); //! length in bytes, not UTF8-symbols
            $lengthExpr = new Expression("CHAR_LENGTH(body)");
            $query->andFilterWhere(['>=', $lengthExpr, $this->bodyMinLength]);
        }

        // additional search criterias
        $query->andFilterWhere(['owner_id' => $this->owner_id]);
        $query->andFilterWhere(['like', 'title', $this->title]);
        $query->andFilterWhere(['like', 'body', $this->body]);

        //list($sql, $sqlParams) = Yii::$app->db->getQueryBuilder()->build($query);var_dump($sql);var_dump($sqlParams);
        return $dataProvider;
    }
239951
public function search($params)
    {
        $query = Message::find();
        $query->joinWith('source');
        
        $dataProvider = new ActiveDataProvider(['query' => $query]);
        $dataProvider->getSort()->attributes['sourceMessage'] = [
            'asc' => ['source.message' => SORT_ASC],
            'desc' => ['source.message' => SORT_DESC],
        ];
        $dataProvider->getSort()->attributes['sourceCategory'] = [
            'asc' => ['source.category' => SORT_ASC],
            'desc' => ['source.category' => SORT_DESC],
        ];

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere(['id' => $this->id]);
        if ($this->translation) {
            $t = addslashes($this->translation);
            $query->where("translation like '%{$t}%'");
        }

        if ($this->translationUpdate === 'is null') {
            $query->where('translation is null');
        }
        if ($this->translationUpdate === 'is not null') {
            $query->where('translation is not null');
        }

        if ($this->translation) {
            $query->andWhere(['like', 'translation', '%' . $this->translation .'%', false]);
        }
        if ($this->sourceMessage) {
            $query->andFilterWhere(['like', 'source.message', $this->sourceMessage]);
        }

        if ($this->language) {
            $query->andWhere(['language' => $this->language]);
        }
        
        if ($this->sourceCategory) {
            $query->andFilterWhere(['like', 'source.category', $this->sourceCategory]);
        }
        return $dataProvider;
    }
1351253
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', 'info', $this->info])
            ->andFilterWhere(['like', 'sitemap_change_freq', $this->sitemap_change_freq])
            ->andFilterWhere(['like', 'sitemap_priority', $this->sitemap_priority]);

        return $dataProvider;
    }
841049
public function search($params)
    {
        $query = Language::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,
            'domain_id' => $this->domain_id,
            'bydefault' => $this->bydefault,
            'status' => $this->status,
            'position' => $this->position,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'slug', $this->slug])
            ->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'locale', $this->locale])
            ->andFilterWhere(['like', 'alias', $this->alias])
            ->andFilterWhere(['like', 'icon_id', $this->icon_id]);

        return $dataProvider;
    }
986366
public function search($params)
    {
        $query = Country::find()->active();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
          	'is_active' => $this->is_active,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'country_id' => $this->country_id,
        ]);

        $query->andFilterWhere(['like', 'iso2', $this->iso2])
            ->andFilterWhere(['like', 'iso3', $this->iso3])
          	->andFilterWhere(['like', 'name', $this->name]);

        return $dataProvider;
    }
1135221
public function search($params)
    {
        $query = Account::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([
            'account_id' => $this->account_id,
            'balance_debit' => $this->balance_debit,
            'balance_credit' => $this->balance_credit,
            'balance' => $this->balance,
        ]);

        $query->andFilterWhere(['like', 'accounttype', $this->accounttype])
            ->andFilterWhere(['like', 'name', $this->name]);

        return $dataProvider;
    }
1098876
public function search($params = [])
    {
        $query = Server::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'osimage' => $this->osimage,
            'livecd'  => $this->livecd,
        ]);

        return $dataProvider;
    }
743258
public function search($params)
    {
        $query = Log::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,
            'user_id' => $this->user_id,
            'created_at' => $this->created_at,
        ]);

        $query->andFilterWhere(['like', 'route', $this->route])
            ->andFilterWhere(['like', 'description', $this->description]);

        return $dataProvider;
    }
1223935
public function search($params)
    {
        $query = self::find()->orderBy('created_at DESC');

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            return $dataProvider;
        }

        if ($this->tagIds) {
            $query->joinWith('tags')->andFilterWhere(['in', Tag::tableName() . '.id', $this->tagIds]);
        }

        return $dataProvider;
    }
288143
public function search($params)
    {
        $query = Task::find();

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => [
                    'id' => SORT_ASC,
                ]
            ],
        ]);

        $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,
            'switch' => $this->switch,
            'status' => $this->status,
            'last_rundate' => $this->last_rundate,
            'next_rundate' => $this->next_rundate,
            'execmemory' => $this->execmemory,
            'exectime' => $this->exectime,
        ]);

        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'route', $this->route])
            ->andFilterWhere(['like', 'crontab_str', $this->crontab_str]);

        return $dataProvider;
    }
670407
public function search($params)
    {
        $query = Category::find();
        $query->orderBy('position DESC, title');

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'parent_id' => $this->parent_id,
            'position' => $this->position,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'alias', $this->alias]);

        return $dataProvider;
    }
752388
private function searchActiveDataProvider($params)
    {
        /** @var ActiveRecord $model */
        $model = $this->identityImplement;
        $query = $model::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        foreach ($model::getTableSchema()->columns as $attribute => $column) {
            if ($column->phpType === 'string') {
                $query->andFilterWhere(['like', $attribute, $model->getAttribute($attribute)]);
            } else {
                $query->andFilterWhere([$attribute => $model->getAttribute($attribute)]);
            }
        }

        return $dataProvider;
    }
1210507
public function search($params)
    {
        $query = SeoSlug::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => ['id' => SORT_DESC],
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            SeoSlug::tableName() . '.model_id' => $this->model_id,
        ])->andFilterWhere(['LIKE', SeoSlug::tableName() . '.model', $this->model])
            ->andFilterWhere(['LIKE', SeoSlug::tableName() . '.slug', $this->slug]);
        return $dataProvider;
    }
201071
public function search($params)
    {
        $query = Item::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,
            'user_id' => $this->user_id,
            'parent_id' => $this->parent_id,
            'branch_id' => $this->branch_id,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'active' => $this->active,
        ]);

        $query->andFilterWhere(['like', 'parent_class', $this->parent_class])
            ->andFilterWhere(['like', 'content', $this->content]);

        return $dataProvider;
    }
1374115
public function search($params)
    {
        $query = SeoRedirect::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => [
                'defaultOrder' => ['id' => SORT_DESC],
            ],
        ]);
        $this->load($params);
        if (!$this->validate()) {
            return $dataProvider;
        }
        $query->andFilterWhere([
            SeoRedirect::tableName() . '.id' => $this->id,
            SeoRedirect::tableName() . '.code' => $this->code,
        ])->andFilterWhere(['LIKE', SeoRedirect::tableName() . '.from', $this->from])
            ->andFilterWhere(['LIKE', SeoRedirect::tableName() . '.to', $this->to]);
        return $dataProvider;
    }
922872
public function search($params)
    {
        $query = $this->finder->getUserQuery();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
            'sort' => ['defaultOrder' => ['created_at' => SORT_DESC]],
        ]);

        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }

        $modelClass = $query->modelClass;
        $table_name = $modelClass::tableName();

        if ($this->created_at !== null) {
            $date = strtotime($this->created_at);
            $query->andFilterWhere(['between', $table_name . '.created_at', $date, $date + 3600 * 24]);
        }

        $query->andFilterWhere(['like', $table_name . '.username', $this->username])
              ->andFilterWhere(['like', $table_name . '.email', $this->email])
              ->andFilterWhere([$table_name . '.id' => $this->id])
              ->andFilterWhere([$table_name . '.registration_ip' => $this->registration_ip]);

        return $dataProvider;
    }
313992
public function search($params)
    {
        $query = AuthRule::find();
        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);
        if (!($this->load($params) && $this->validate())) {
            return $dataProvider;
        }
        $query->andFilterWhere([
                'created_at' => $this->created_at,
                'updated_at' => $this->updated_at,
            ]);
        $query->andFilterWhere(['like', 'name', $this->name])
            ->andFilterWhere(['like', 'data', $this->data]);
        return $dataProvider;
    }