Hi,
I have this view:
<div class="form">
<?php echo CHtml::beginForm(); ?>
<?php echo CHtml::errorSummary(array($view->company, $view->user)); ?>
<fieldset>
<legend>Company details</legend>
<p>Enter your company details here.</p>
<label>Company name</label><br />
<?php echo CHtml::textField($view->company, "name") ?><br />
<label>Company contact number</label><br />
<?php echo CHtml::textField($view->company, "contact_number") ?>
</fieldset>
<fieldset>
<legend>User details</legend>
<p>Enter your user details here.</p>
<label>Email</label><br />
<?php echo CHtml::textField($view->user, "email") ?><br />
<label>Confirm your email</label><br />
<?php echo CHtml::textField($view->user, "email_confirmation") ?><br />
<label>Firstname</label><br />
<?php echo CHtml::textField($view->user, "first_name") ?><br />
<label>Lastname</label><br />
<?php echo CHtml::textField($view->user, "last_name") ?><br />
<label>Password</label><br />
<?php echo CHtml::passwordField($view->user, "password") ?><br />
<label>Confirm your password</label><br />
<?php echo CHtml::passwordField($view->user, "password_confirmation") ?><br /><br />
<?php echo CHtml::submitButton("Sign up your new account"); ?>
</fieldset>
<?php echo CHtml::endForm(); ?>
</div>
I have this controller action:
public function actionSignUp() {
$company = new Company;
$user = new User;
if(isset($_POST["Company"], $_POST["User"])) {
$company->attributes = $_POST["Company"];
$user->attributes = $_POST["User"];
if($company->validate() && $user->validate()) {
$company->save();
$user->fk_id_with_company_id = $company->id;
$user->save();
$this->redirect(array("site/index"));
}
}
$view->company = $company;
$view->user = $user;
$this->render("SignUp", array("view" => $view));
}
}
I am getting this error: -
"Object of class Company could not be converted to string"
Can anybody see what the problem is?