/** * @return \yii\db\ActiveQuery */ public function getIdPuerto() { return $this->hasOne(Puertos::className(), ['id' => 'id_puerto']); }
/** * Finds the Puertos model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Puertos the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Puertos::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/* @var $form yii\widgets\ActiveForm */ ?> <div class="funcionalidad-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'id_mother')->dropDownList(ArrayHelper::map(Mother::find()->all(), 'id', 'nombre'))->label('Mother'); ?> <?php echo $form->field($model, 'id_puerto')->dropDownList(ArrayHelper::map(Puertos::find()->all(), 'id', ['nombre']))->label('Puerto'); ?> <?php echo $form->field($model, 'descripcion')->textInput(['maxlength' => true]); ?> <div class="form-group"> <?php echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']); ?> </div> <?php ActiveForm::end();