/**
  * Finds the TicketGroup model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return TicketGroup the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = TicketGroup::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #2
0
 public function getTicketGroups()
 {
     return $this->hasMany(TicketGroup::className(), ['event_id' => 'id']);
 }
예제 #3
0
use yii\widgets\ActiveForm;
use app\models\TicketGroup;
use app\models\TicketType;
/* @var $this yii\web\View */
/* @var $model app\models\Ticket */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="ticket-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'group_id')->dropDownList(TicketGroup::getList());
?>

    <?php 
echo $form->field($model, 'type_id')->dropDownList(TicketType::getList());
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'ticket_price')->textInput(['maxlength' => true]);
?>

    <?php 
예제 #4
0
 public function getGroup()
 {
     return $this->hasOne(TicketGroup::className(), ['id' => 'group_id']);
 }