| Current Path : /var/www/html/brspace/backend/modules/appendix/models/ |
| Current File : /var/www/html/brspace/backend/modules/appendix/models/AppendixSearch.php |
<?php
namespace backend\modules\appendix\models;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\modules\appendix\models\Appendix;
/**
* AppendixSearch represents the model behind the search form of `backend\modules\appendix\models\Appendix`.
*/
class AppendixSearch extends Appendix
{
/**
* {@inheritdoc}
*/
public function rules()
{
return [
[['appendix_id', 'appendix_data_id', 'appendix_sort'], 'integer'],
[['appendix_table_name', 'appendix_doc_name', 'appendix_file_url'], 'safe'],
];
}
/**
* {@inheritdoc}
*/
public function scenarios()
{
// bypass scenarios() implementation in the parent class
return Model::scenarios();
}
/**
* Creates data provider instance with search query applied
*
* @param array $params
*
* @return ActiveDataProvider
*/
public function search($params)
{
$query = Appendix::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([
'appendix_id' => $this->appendix_id,
'appendix_data_id' => $this->appendix_data_id,
]);
$query->andFilterWhere(['like', 'appendix_table_name', $this->appendix_table_name])
->andFilterWhere(['like', 'appendix_doc_name', $this->appendix_doc_name])
->andFilterWhere(['like', 'appendix_file_url', $this->appendix_file_url]);
return $dataProvider;
}
}