private function createDefaultCellarLoc($cellar_id) { $newCellarLoc = new CellarLocation(); $newCellarLoc->cellar_id = $cellar_id; $newCellarLoc->location = "Other"; $newCellarLoc->location_desc = "Location not assigned"; $newCellarLoc->save(); return $newCellarLoc->cellar_loc_id; }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate($cellar_id) { $model = new CellarLocation(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['CellarLocation'])) { $model->attributes = $_POST['CellarLocation']; $model->attributes = array('cellar_id' => $cellar_id); if ($model->save()) { $this->redirect(array('view', 'id' => $model->cellar_loc_id, 'cellar_id' => $cellar_id)); } } $this->render('create', array('model' => $model, 'cellar_id' => $cellar_id)); }