| Current Path : /var/www/html/chatbot/backend/models/ |
| Current File : /var/www/html/chatbot/backend/models/ReportGraphSearch.php |
<?php
namespace backend\models;
use Yii;
use yii\base\Model;
use yii\data\ActiveDataProvider;
use backend\models\ReportGraph;
/**
* ReportGraphSearch represents the model behind the search form about `backend\models\ReportGraph`.
*/
class ReportGraphSearch extends ReportGraph
{
/**
* @inheritdoc
*/
public function rules()
{
return [
[[ 'id_report_meta'], 'integer'],
[['title_graph', 'table_name', 'sql_statement', 'yAxis', 'xAxis', 'yAxis_replacement_name', 'type_report','graph_type', 'created_at', 'created_by', 'updated_at', 'updated_by'], '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 = ReportGraph::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_report_graph' => $this->id_report_graph,
'id_report_meta' => $this->id_report_meta,
]);
$query->andFilterWhere(['like', 'title_graph', $this->title_graph])
->andFilterWhere(['like', 'table_name', $this->table_name])
->andFilterWhere(['like', 'sql_statement', $this->sql_statement])
->andFilterWhere(['like', 'yAxis', $this->yAxis])
->andFilterWhere(['like', 'xAxis', $this->xAxis])
->andFilterWhere(['like', 'yAxis_replacement_name', $this->yAxis_replacement_name])
->andFilterWhere(['like', 'type_report', $this->type_report])
->andFilterWhere(['like', 'graph_type', $this->graph_type])
->andFilterWhere(['like', 'created_at', $this->created_at])
->andFilterWhere(['like', 'created_by', $this->created_by])
->andFilterWhere(['like', 'updated_at', $this->updated_at])
->andFilterWhere(['like', 'updated_by', $this->updated_by]);
return $dataProvider;
}
}