/** * @return \yii\db\ActiveQuery */ public function getRoom() { return $this->hasOne(Msroom::className(), ['RoomID' => 'RoomID']); }
use yii\helpers\ArrayHelper; use yii\helpers\Html; use yii\widgets\ActiveForm; use yii\jui\DatePicker; use app\models\Msroom; use app\models\Mspatient; use app\models\Msdoctor; use kartik\datetime\DateTimePicker; /* @var $this yii\web\View */ /* @var $model app\models\Trreservation */ /* @var $form yii\widgets\ActiveForm */ ?> <?php $listRoom = ArrayHelper::map(Msroom::find()->all(), 'RoomID', 'RoomName'); $listPatient = ArrayHelper::map(Mspatient::find()->all(), 'PatientID', 'FirstName'); $listDoctor = ArrayHelper::map(Msdoctor::find()->all(), 'DoctorID', 'FirstName'); ?> <div class="trreservation-form"> <?php $form = ActiveForm::begin(); ?> <?php echo $form->field($model, 'Date')->widget(DateTimePicker::className()); ?> <?php
/** * Finds the Msroom model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Msroom the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Msroom::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }