/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Neumatico::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(['neu_valor_compra' => $this->neu_valor_compra, 'neu_fecha_compra' => $this->neu_fecha_compra, 'neu_ancho' => $this->neu_ancho, 'neu_altura' => $this->neu_altura, 'neu_diametro' => $this->neu_diametro, 'neu_km_acumulados' => $this->neu_km_acumulados]); $query->andFilterWhere(['like', 'neu_serie', $this->neu_serie])->andFilterWhere(['like', 'emp_rut', $this->emp_rut])->andFilterWhere(['like', 'neu_marca', $this->neu_marca])->andFilterWhere(['like', 'neu_observaciones', $this->neu_observaciones])->andFilterWhere(['like', 'neu_imagen', $this->neu_imagen]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getNeuSeries() { return $this->hasMany(Neumatico::className(), ['neu_serie' => 'neu_serie'])->viaTable('uni_veh_neu', ['veh_patente' => 'veh_patente']); }
/** * @return \yii\db\ActiveQuery */ public function getNeumaticos() { return $this->hasMany(Neumatico::className(), ['emp_rut' => 'emp_rut']); }
/** * Finds the Neumatico model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Neumatico the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Neumatico::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }