Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Proveedores::find();
     // add conditions that should always apply here
     $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;
     }
     // grid filtering conditions
     $query->andFilterWhere(['proveedor_id' => $this->proveedor_id, 'user_id' => $this->user_id, 'ramo_id' => $this->ramo_id]);
     $query->andFilterWhere(['like', 'empresa', $this->empresa])->andFilterWhere(['like', 'datos_fiscales', $this->datos_fiscales])->andFilterWhere(['like', 'web', $this->web])->andFilterWhere(['like', 'direccion_oficina', $this->direccion_oficina])->andFilterWhere(['like', 'comentarios', $this->comentarios]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProveedor()
 {
     return $this->hasOne(Proveedores::className(), ['proveedor_id' => 'proveedorid']);
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getProveedores()
 {
     return $this->hasMany(Proveedores::className(), ['ramo_id' => 'ramoid']);
 }
Exemplo n.º 4
0
 /**
  * Finds the Proveedores model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Proveedores the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Proveedores::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }