/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Atividades::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, 'agenda_id' => $this->agenda_id, 'relacionamento_id' => $this->relacionamento_id, 'setor_id' => $this->setor_id, 'data_inicio' => $this->data_inicio, 'data_termino' => $this->data_termino, 'ult_usuario_editado' => $this->ult_usuario_editado, 'data_criacao' => $this->data_criacao, 'data_atualizacao' => $this->data_atualizacao]); $query->andFilterWhere(['like', 'atividade', $this->atividade])->andFilterWhere(['like', 'periodicidade', $this->periodicidade])->andFilterWhere(['like', 'dia_inteiro', $this->dia_inteiro])->andFilterWhere(['like', 'condicional_dia_util', $this->condicional_dia_util])->andFilterWhere(['like', 'procedimento', $this->procedimento])->andFilterWhere(['like', 'status', $this->status])->andFilterWhere(['like', 'status_observacao', $this->status_observacao]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getAtividade() { return $this->hasOne(Atividades::className(), ['id' => 'atividade_id']); }
/** * Finds the Atividades model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Atividades the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Atividades::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }