| Current Path : /var/www/html/protegev2/backend/models/frontendcontentassign/ |
| Current File : /var/www/html/protegev2/backend/models/frontendcontentassign/FrontendContentAssignSearch.php |
<?php
namespace backend\models\frontendcontentassign;
use yii\base\Model;
use yii\data\ActiveDataProvider;
/**
* FrontendContentAssignSearch represents the model behind the search form about `backend\models\frontendcontentassign\FrontendContentAssign`.
*/
class FrontendContentAssignSearch extends FrontendContentAssign {
/**
* @inheritdoc
*/
public function rules() {
return [
[['assign_id', 'content_id', 'page_id', 'content_order', 'category_id'], 'integer'],
];
}
/**
* @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 = FrontendContentAssign::find()->innerJoinWith('content');
// add conditions that should always apply here
$dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => false,]]);
$dataProvider->setSort(['defaultOrder' => ['content_order' => 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([
'category_id' => $this->category_id,
'assign_id' => $this->assign_id,
'content_id' => $this->content_id,
'frontend_content_assign.page_id' => $this->page_id,
'content_order' => $this->content_order,
]);
return $dataProvider;
}
}