/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new AccountOwner(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['AccountOwner'])) { $model->attributes = $_POST['AccountOwner']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function saveCompany($subdomain) { if ($this->_id === null) { return false; } if (($record = User::model()->findByPk($this->_id)) !== null) { $company = new AccountOwner(); $company->tenant = $subdomain; $company->name = $subdomain; $company->save(); $record->company_id = $company->id; $record->save(); return $record->company_id; } return false; }