Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = character::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(['created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'id' => $this->id]);
     $query->andFilterWhere(['like', 'importance', $this->importance])->andFilterWhere(['like', 'fullname', $this->fullname])->andFilterWhere(['like', 'nickname', $this->nickname])->andFilterWhere(['like', 'nickname_originated', $this->nickname_originated])->andFilterWhere(['like', 'age', $this->age])->andFilterWhere(['like', 'birth_place', $this->birth_place])->andFilterWhere(['like', 'ethnic_background', $this->ethnic_background])->andFilterWhere(['like', 'native_language', $this->native_language])->andFilterWhere(['like', 'childhood', $this->childhood])->andFilterWhere(['like', 'greatest_trauma', $this->greatest_trauma])->andFilterWhere(['like', 'moment_of_greatest_courage', $this->moment_of_greatest_courage])->andFilterWhere(['like', 'religious_beliefs', $this->religious_beliefs])->andFilterWhere(['like', 'friends', $this->friends])->andFilterWhere(['like', 'whom_they_live_with', $this->whom_they_live_with])->andFilterWhere(['like', 'relationship', $this->relationship])->andFilterWhere(['like', 'children', $this->children])->andFilterWhere(['like', 'previous_relationships', $this->previous_relationships])->andFilterWhere(['like', 'sexuality', $this->sexuality])->andFilterWhere(['like', 'describe_home', $this->describe_home])->andFilterWhere(['like', 'pets', $this->pets])->andFilterWhere(['like', 'occupation', $this->occupation])->andFilterWhere(['like', 'workaday_routine', $this->workaday_routine])->andFilterWhere(['like', 'how_spend_evening', $this->how_spend_evening])->andFilterWhere(['like', 'job_satis_career_ambitions', $this->job_satis_career_ambitions])->andFilterWhere(['like', 'education', $this->education])->andFilterWhere(['like', 'physical_attributes', $this->physical_attributes])->andFilterWhere(['like', 'health', $this->health])->andFilterWhere(['like', 'liberal_conservative', $this->liberal_conservative])->andFilterWhere(['like', 'rebel_or_obedient', $this->rebel_or_obedient])->andFilterWhere(['like', 'sense_of_humor', $this->sense_of_humor])->andFilterWhere(['like', 'neuroses_quirks', $this->neuroses_quirks])->andFilterWhere(['like', 'contradictions', $this->contradictions])->andFilterWhere(['like', 'emotional_triggers', $this->emotional_triggers])->andFilterWhere(['like', 'mannerisms_voice_laugh', $this->mannerisms_voice_laugh])->andFilterWhere(['like', 'addictions', $this->addictions])->andFilterWhere(['like', 'created_by', $this->created_by])->andFilterWhere(['like', 'updated_by', $this->updated_by])->andFilterWhere(['like', 'name_meaning_historical', $this->name_meaning_historical])->andFilterWhere(['like', 'name_meaning_for_author', $this->name_meaning_for_author])->andFilterWhere(['like', 'year_born', $this->year_born])->andFilterWhere(['like', 'year_died', $this->year_died])->andFilterWhere(['like', 'first_name', $this->first_name])->andFilterWhere(['like', 'last_name', $this->last_name])->andFilterWhere(['like', 'middle_name', $this->middle_name])->andFilterWhere(['like', 'personality_character', $this->personality_character]);
     return $dataProvider;
 }
Ejemplo n.º 2
0
 public function actionXml()
 {
     $models = character::find()->all();
     $data = array_map(function ($model) {
         return $model->attributes;
     }, $models);
     $response = Yii::$app->response;
     $response->format = Response::FORMAT_XML;
     $response->data = $data;
     return $response;
 }