Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 33 |
| AccompanyingEventSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
20.00 | |
0.00% |
0 / 33 |
| rules | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 6 |
|||
| scenarios | |
0.00% |
0 / 1 |
2.00 | |
0.00% |
0 / 3 |
|||
| search | |
0.00% |
0 / 1 |
6.00 | |
0.00% |
0 / 24 |
|||
| <?php | |
| namespace backend\models; | |
| use Yii; | |
| use yii\base\Model; | |
| use yii\data\ActiveDataProvider; | |
| use common\models\AccompanyingEvent; | |
| /** | |
| * AccompanyingEventSearch represents the model behind the search form about `common\models\AccompanyingEvent`. | |
| */ | |
| class AccompanyingEventSearch extends AccompanyingEvent | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['id', 'limit', 'is_enabled', 'created_at', 'updated_at', 'parent_event_id'], 'integer'], | |
| [['name', 'date', 'time', 'registration_from', 'registration_to'], '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 = AccompanyingEvent::find(); | |
| $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; | |
| } | |
| $query->andFilterWhere([ | |
| 'id' => $this->id, | |
| 'date' => $this->date, | |
| 'time' => $this->time, | |
| 'limit' => $this->limit, | |
| 'registration_from' => $this->registration_from, | |
| 'registration_to' => $this->registration_to, | |
| 'is_enabled' => $this->is_enabled, | |
| 'created_at' => $this->created_at, | |
| 'updated_at' => $this->updated_at, | |
| 'parent_event_id' => $this->parent_event_id, | |
| ]); | |
| $query->andFilterWhere(['like', 'name', $this->name]); | |
| return $dataProvider; | |
| } | |
| } |