Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 44 |
| OrganizationSearch | |
0.00% |
0 / 1 |
|
0.00% |
0 / 3 |
20.00 | |
0.00% |
0 / 44 |
| 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 / 35 |
|||
| <?php | |
| namespace backend\models; | |
| use Yii; | |
| use yii\base\Model; | |
| use yii\data\ActiveDataProvider; | |
| use common\models\Organization; | |
| /** | |
| * OrganizationSearch represents the model behind the search form about `common\models\Organization`. | |
| */ | |
| class OrganizationSearch extends Organization | |
| { | |
| /** | |
| * @inheritdoc | |
| */ | |
| public function rules() | |
| { | |
| return [ | |
| [['id', 'created_at', 'updated_at', 'organization_profile_id', 'organization_type_id', 'event_id', 'supervisor_id'], 'integer'], | |
| [['name', 'email', 'address', 'postal_code', 'city', 'country', 'phone', 'fax', 'website', 'founded', 'organization_size', 'image', 'description', 'offer', 'interest'], '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 = Organization::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, | |
| 'founded' => $this->founded, | |
| 'organization_size' => $this->organization_size, | |
| 'created_at' => $this->created_at, | |
| 'updated_at' => $this->updated_at, | |
| 'organization_profile_id' => $this->organization_profile_id, | |
| 'organization_type_id' => $this->organization_type_id, | |
| 'event_id' => $this->event_id, | |
| 'supervisor_id' => $this->supervisor_id, | |
| ]); | |
| $query->andFilterWhere(['like', 'name', $this->name]) | |
| ->andFilterWhere(['like', 'email', $this->email]) | |
| ->andFilterWhere(['like', 'address', $this->address]) | |
| ->andFilterWhere(['like', 'postal_code', $this->postal_code]) | |
| ->andFilterWhere(['like', 'city', $this->city]) | |
| ->andFilterWhere(['like', 'country', $this->country]) | |
| ->andFilterWhere(['like', 'phone', $this->phone]) | |
| ->andFilterWhere(['like', 'fax', $this->fax]) | |
| ->andFilterWhere(['like', 'website', $this->website]) | |
| ->andFilterWhere(['like', 'image', $this->image]) | |
| ->andFilterWhere(['like', 'description', $this->description]) | |
| ->andFilterWhere(['like', 'offer', $this->offer]) | |
| ->andFilterWhere(['like', 'interest', $this->interest]); | |
| return $dataProvider; | |
| } | |
| } |