/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer $id the ID of the model to be loaded * @return Appellations the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Appellations::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<?php echo $form->dropDownList($model, 'winery_id', $wineries_list, array('empty' => '(Select a Winery)')); ?> <?php echo $form->error($model, 'winery_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'appellation_id'); $criteria = new CDbCriteria(); $criteria->with = array('region'); $criteria->compare('t.common_flg', 'Y'); $criteria->order = 'region.region_name ASC, t.appellation ASC'; $appellation_list = CHtml::listData(Appellations::model()->findAll($criteria), 'id', 'regionAppellation'); echo $form->dropDownList($model, 'appellation_id', $appellation_list, array('empty' => '(Select an Appellation)')); echo $form->error($model, 'appellation_id'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'wine_year'); ?> <?php echo $form->textField($model, 'wine_year', array('size' => 4, 'maxlength' => 4)); ?> <?php echo $form->error($model, 'wine_year'); ?>