/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Subscriber::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, 'group_id' => $this->group_id, 'COS' => $this->COS, 'FORWARD_ON_RNA_enabled' => $this->FORWARD_ON_RNA_enabled, 'FORWARD_ON_BUSY_enabled' => $this->FORWARD_ON_BUSY_enabled, 'FORWARD_UNC_enabled' => $this->FORWARD_UNC_enabled, 'clip' => $this->clip, 'clir' => $this->clir, 'mwi' => $this->mwi, 'call_hunting_type' => $this->call_hunting_type, 'first_update' => $this->first_update, 'last_update' => $this->last_update]); $query->andFilterWhere(['like', 'number', $this->number])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'FORWARD_ON_RNA_number', $this->FORWARD_ON_RNA_number])->andFilterWhere(['like', 'FORWARD_ON_BUSY_number', $this->FORWARD_ON_BUSY_number])->andFilterWhere(['like', 'FORWARD_UNC_number', $this->FORWARD_UNC_number])->andFilterWhere(['like', 'call_hunting', $this->call_hunting])->andFilterWhere(['like', 'first_user', $this->first_user])->andFilterWhere(['like', 'last_user', $this->last_user])->andFilterWhere(['like', 'first_ip', $this->first_ip])->andFilterWhere(['like', 'last_ip', $this->last_ip]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getSubscribers() { return $this->hasMany(Subscriber::className(), ['group_id' => 'id']); }
/** * Finds the Subscriber model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Subscriber the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Subscriber::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }