/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Documento::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(['iddocumento' => $this->iddocumento, 'candidato_idcandidato' => $this->candidato_idcandidato]); $query->andFilterWhere(['like', 'tipo_documento', $this->tipo_documento])->andFilterWhere(['like', 'numero_documento', $this->numero_documento])->andFilterWhere(['like', 'link_documento', $this->link_documento]); return $dataProvider; }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Documento::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 100]]); $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, 'fecha_creacion' => $this->fecha_creacion, 'id_persona' => $this->id_persona]); $query->andFilterWhere(['like', 'nombre_documento', $this->nombre_documento])->andFilterWhere(['like', 'direccion_archivo', $this->direccion_archivo]); return $dataProvider; }
/** * Finds the Documento model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Documento the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Documento::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getDocumentos() { return $this->hasMany(Documento::className(), ['id_persona' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getDocumentos() { return $this->hasMany(Documento::className(), ['candidato_idcandidato' => 'idcandidato']); }
<?php use yii\helpers\Html; use yii\grid\GridView; use yii\helpers\Url; use backend\models\Documento; /* @var $this yii\web\View */ /* @var $model backend\models\Candidato */ $this->title = 'Update Candidato: ' . ' ' . $model->idcandidato; $this->params['breadcrumbs'][] = ['label' => 'Candidatos', 'url' => ['index']]; $this->params['breadcrumbs'][] = ['label' => $model->idcandidato, 'url' => ['view', 'id' => $model->idcandidato]]; $this->params['breadcrumbs'][] = 'Update'; $modelDoc = Documento::find()->where(['candidato_idcandidato' => $model->idcandidato])->one(); ?> <div class="candidato-update"> <h1><?php echo Html::encode($this->title); ?> </h1> <?php echo $this->render('_form', ['model' => $model]); ?> <p> <?php echo Html::a('Criar Documento', ['/documento/create', 'idcandidato' => $model->idcandidato], ['class' => 'btn btn-success']); ?> </p>