/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Acervo::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, 'tipoAcervo_id' => $this->tipoAcervo_id, 'ancho' => $this->ancho, 'largo' => $this->largo, 'alto' => $this->alto, 'unidadMedida_id' => $this->unidadMedida_id, 'peso' => $this->peso, 'unidadPeso_id' => $this->unidadPeso_id, 'diametroInterno' => $this->diametroInterno, 'diametroExterno' => $this->diametroExterno, 'fechaIngreso' => $this->fechaIngreso, 'ingreso_id' => $this->ingreso_id, 'estado_id' => $this->estado_id, 'ubicacion_id' => $this->ubicacion_id, 'fechaBaja' => $this->fechaBaja, 'motivoBaja_id' => $this->motivoBaja_id, 'copia_id' => $this->copia_id, 'codformaing' => $this->codformaing, 'codtipoac' => $this->codtipoac, 'clasifac' => $this->clasifac, 'publicar_id' => $this->publicar_id, 'idold' => $this->idold]);
     $query->andFilterWhere(['like', 'nombre', $this->nombre])->andFilterWhere(['like', 'descripcion', $this->descripcion])->andFilterWhere(['like', 'nroInventario', $this->nroInventario])->andFilterWhere(['like', 'forma', $this->forma])->andFilterWhere(['like', 'material', $this->material])->andFilterWhere(['like', 'caracteristicas', $this->caracteristicas])->andFilterWhere(['like', 'lugarprocac', $this->lugarprocac])->andFilterWhere(['like', 'color', $this->color])->andFilterWhere(['like', 'notas', $this->notas])->andFilterWhere(['like', 'descEpoca', $this->descEpoca])->andFilterWhere(['like', 'descUbicacion', $this->descUbicacion])->andFilterWhere(['like', 'nroA', $this->nroA])->andFilterWhere(['like', 'nroB', $this->nroB])->andFilterWhere(['like', 'nroC', $this->nroC])->andFilterWhere(['like', 'nroD', $this->nroD]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcervos()
 {
     return $this->hasMany(Acervo::className(), ['colecciones_id' => 'id']);
 }
 /**
  * Displays a single Ingreso model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     $acervosProvider = new \yii\data\ActiveDataProvider(['query' => \app\models\Acervo::find()->joinWith('ingreso')->where(['ingreso.persona_id' => $id])]);
     return $this->render('view', ['model' => $model, 'acervos' => $acervosProvider]);
 }
Пример #4
0
 public function getdropAcervo()
 {
     $data = Acervo::find()->asArray()->all();
     return ArrayHelper::map($data, 'id', 'nombre');
 }
 /**
  * Finds the Acervo model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Acervo the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Acervo::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcervo()
 {
     return $this->hasOne(Acervo::className(), ['id' => 'acervo_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcervos()
 {
     return $this->hasMany(Acervo::className(), ['unidadPeso_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcervos()
 {
     return $this->hasMany(Acervo::className(), ['ubicacion_id' => 'id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getObjetos()
 {
     return $this->hasOne(Acervo::className(), ['id' => 'objetos_id']);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAcervos()
 {
     return $this->hasMany(Acervo::className(), ['clasificacionGenerica_id' => 'id']);
 }