/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = EmailTemplates::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, 'created_by' => $this->created_by, 'created_date' => $this->created_date, 'modified_by' => $this->modified_by, 'modified_date' => $this->modified_date]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'subject', $this->subject])->andFilterWhere(['like', 'sender_options', $this->sender_options])->andFilterWhere(['like', 'sender', $this->sender])->andFilterWhere(['like', 'contents', $this->contents])->andFilterWhere(['like', 'signature_options', $this->signature_options])->andFilterWhere(['like', 'signature', $this->signature])->andFilterWhere(['like', 'header', $this->header])->andFilterWhere(['like', 'footer', $this->footer]); return $dataProvider; }
public function getTemplates() { return yii\helpers\ArrayHelper::map(EmailTemplates::find()->all(), 'id', 'title'); }