/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new DeathRecord(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['DeathRecord'])) { $model->attributes = $_POST['DeathRecord']; if ($model->save()) { if ($model->member_id) { if (!isset($model->member->death_dt)) { $member = $model->member; $member->death_dt = $model->death_dt; if (!$member->save(true, array('death_dt'))) { Yii::trace(sprintf('Error saving member %d death_dt: %s', $member->id, implode(', ', $member->getErrors('death_dt'))), 'application.controllers.DeathRecord'); } } } $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }