Esempio n. 1
0
 /**
  * Updates a particular model.
  * If update is successful, the browser will be redirected to the 'view' page.
  * @param integer $id the ID of the model to be updated
  */
 public function actionUpdate($id)
 {
     $model = $this->loadModel($id);
     // Uncomment the following line if AJAX validation is needed
     $this->performAjaxValidation($model);
     //var_dump($model->recipients);
     if (isset($_POST['Event'])) {
         $model->attributes = $_POST['Event'];
         if ($model->save()) {
             $recipient = new Recipient();
             $recipient->email = "emailaddress1";
             $recipient->event_id = $model->id;
             if (!$recipient->save()) {
                 var_dump($recipient->getErrors());
                 die;
             }
             $this->redirect(array('update', 'id' => $model->id));
         }
     }
     $this->render('update', array('model' => $model));
 }