/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Publicar::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(['like', 'id', $this->id]); return $dataProvider; }
use yii\bootstrap\Modal; use kartik\widgets\FileInput; /* @var $this yii\web\View */ /* @var $model app\models\Acervo */ /* @var $form yii\widgets\ActiveForm */ ?> <div class="acervo-form"> <?php // die("--".$publicar); $form = ActiveForm::begin(['type' => ActiveForm::TYPE_VERTICAL]); ?> <?php $dataPublicar = ArrayHelper::map(\app\models\Publicar::find()->asArray()->all(), 'id', 'id'); ?> <div class="row"> <div class="col-sm-4"> <?php echo $form->field($model, 'nombre')->textInput(); ?> </div> <div class="col-sm-4"> <?php echo $form->field($model, 'nroInventario')->textInput(); ?> </div> <div class="col-sm-4">
/** * @return \yii\db\ActiveQuery */ public function getPublicar() { return $this->hasOne(Publicar::className(), ['id' => 'publicar_id']); }
/** * Finds the Publicar model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param string $id * @return Publicar the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Publicar::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }