/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = StyleMe::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(['style_me_id' => $this->style_me_id, 'style_id' => $this->style_id, 'end_date' => $this->end_date]); $query->andFilterWhere(['like', 'customer_user_name1', $this->customer_user_name1])->andFilterWhere(['like', 'customer_user_name2', $this->customer_user_name2])->andFilterWhere(['like', 'my_comment', $this->my_comment])->andFilterWhere(['like', 'friends_comment', $this->friends_comment])->andFilterWhere(['like', 'completion_status', $this->completion_status]); return $dataProvider; }
/** * Finds the StyleMe model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $style_me_id * @param string $customer_user_name1 * @param string $customer_user_name2 * @return StyleMe the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($style_me_id, $customer_user_name1, $customer_user_name2) { if (($model = StyleMe::findOne(['style_me_id' => $style_me_id, 'customer_user_name1' => $customer_user_name1, 'customer_user_name2' => $customer_user_name2])) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }