Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Entregable::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->leftJoin('valoresTramite att_nombre', 'att_nombre.tramiteId=Tramites.id and att_nombre.atributoId=45');
     $query->leftJoin('valoresTramite att_direccion', 'att_direccion.tramiteId=Tramites.id and att_direccion.atributoId=46');
     $query->leftJoin('valoresTramite att_imprimirLicencia', 'att_imprimirLicencia.tramiteId=Tramites.id and att_imprimirLicencia.atributoId=47');
     $query->andFilterWhere(['id' => $this->id, 'pasoActualId' => $this->pasoActualId, 'tipoTramiteId' => $this->tipoDeTramite()]);
     $query->andFilterWhere(['like', 'att_nombre.valor', $this->nombre])->andFilterWhere(['like', 'att_direccion.valor', $this->direccion])->andFilterWhere(['like', 'att_imprimirLicencia.valor', $this->imprimirLicencia]);
     return $dataProvider;
 }
Example #2
0
 /**
  * Finds the Entregable model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Entregable the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Entregable::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }