예제 #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Tecnico::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_tecn' => $this->id_tecn, 'id_cant' => $this->id_cant, 'ci_tecn' => $this->ci_tecn, 'num_viv_asig' => $this->num_viv_asig]);
     $query->andFilterWhere(['like', 'nom_tecn', $this->nom_tecn])->andFilterWhere(['like', 'ape_tecn', $this->ape_tecn])->andFilterWhere(['like', 'obs_tecn', $this->obs_tecn])->andFilterWhere(['like', 'nombre_corto', $this->nombre_corto]);
     return $dataProvider;
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTecnicos()
 {
     return $this->hasMany(Tecnico::className(), ['id_cant' => 'id_cant']);
 }
예제 #3
0
 /**
  * Finds the Tecnico model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Tecnico the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Tecnico::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }