I keep getting the following everytime I try to create my first record in the User model.
'adxc.tbl_profile' indeed does not exsist, but in the Profile model:
The UserController contains:
I'm at a loss. Can anyone point me in the right direction? Thanks.
CDbException CDbCommand failed to execute the SQL statement: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'adxc.tbl_profile' doesn't exist. The SQL statement executed was: INSERT INTO `tbl_users` (`role`, `is_active`, `first_name`, `last_name`, `email`, `username`, `password_salt`, `password`, `date_created`) VALUES (:yp0, :yp1, :yp2, :yp3, :yp4, :yp5, :yp6, :yp7, :yp8)
'adxc.tbl_profile' indeed does not exsist, but in the Profile model:
/** * @return string the associated database table name */ public function tableName() { return '{{profiles}}'; }
The UserController contains:
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $userModel = new User; $profileModel = new Profile; // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['User'], $_POST['Profile'])) { // Populate the models with the inpute data $userModel->attributes = $_POST['User']; $profileModel->attributes = $_POST['Profile']; // You must validate BOTH prior to saving to get validation errors $isValid = $userModel->validate(); $isValid = $profileModel->validate() && $isValid; // if ($isValid) { // Use the false parameter to disable re-validation on save() $userModel->save(false); $profileModel->user_id = $userModel->id; $profileModel->save(false); //Redirect to the 'view' page $this->redirect(array('user/view', 'id' => $userModel->id)); } // EndIf ($isValid) } //EndIf (isset())
I'm at a loss. Can anyone point me in the right direction? Thanks.