Fatal error: Call to a member function getErrors() on a non-object

Im using yii-user and i get the error on the profile edit page. It was working at one point, i have no idea what happened.

Here is the edit view:




<?php $this->pageTitle=Yii::app()->name . ' - '.UserModule::t("Profile");

$this->breadcrumbs=array(

	UserModule::t("Profile")=>array('profile'),

	UserModule::t("Edit"),

);

?><h1><?php echo UserModule::t('Edit Personal Profile'); ?></h1>

<?php echo $this->renderPartial('menu'); ?>


<?php if(Yii::app()->user->hasFlash('profileMessage')): ?>

<div class="success">

<?php echo Yii::app()->user->getFlash('profileMessage'); ?>

</div>

<?php endif; ?>

<div class="container2">

<div class="form">

<?php $form=$this->beginWidget('UActiveForm', array(

	'id'=>'profile-form',

	'enableAjaxValidation'=>true,

	'htmlOptions' => array('enctype'=>'multipart/form-data'),

)); ?>


	<?php echo $form->errorSummary(array($model,$profile)); ?>

        <div class="forms">

<?php 

		$profileFields=$profile->getFields();

		if ($profileFields) {

			foreach($profileFields as $field) {

			?>

	<div class="row">

		<?php echo $form->labelEx($profile,$field->varname);

		

		if ($field->widgetEdit($profile)) {

			echo $field->widgetEdit($profile);

		} elseif ($field->range) {

			echo $form->dropDownList($profile,$field->varname,Profile::range($field->range));

		} elseif ($field->field_type=="TEXT") {

			echo $form->textArea($profile,$field->varname,array('rows'=>6, 'cols'=>50));

		} else {

			echo $form->textField($profile,$field->varname,array('size'=>60,'maxlength'=>(($field->field_size)?$field->field_size:255)));

		}

		echo $form->error($profile,$field->varname); ?>

	</div>	

			<?php

			}

		}

?>

	<div class="row">

		<?php echo $form->labelEx($model,'email'); ?>

		<?php echo $form->textField($model,'email',array('size'=>60,'maxlength'=>128)); ?>

		<?php echo $form->error($model,'email'); ?>

	</div>

            <div id="formfooter"></div>

	<div class="row buttons">


		<?php echo CHtml::submitButton($model->isNewRecord ? UserModule::t('Create') : UserModule::t('Save')); ?>

	</div>

        </div>

<?php $this->endWidget(); ?>


</div><!-- form -->

</div>




Here is the controller edit action:




public function actionEdit()

	{

		$model = $this->loadUser();

		$profile=$model->profile;

		

		// ajax validator

		if(isset($_POST['ajax']) && $_POST['ajax']==='profile-form')

		{

			echo UActiveForm::validate(array($model,$profile));

			Yii::app()->end();

		}

		

		if(isset($_POST['User']))

		{

			$model->attributes=$_POST['User'];

			$profile->attributes=$_POST['Profile'];

			

			if($model->validate()&&$profile->validate()) {

                            

				$model->save();

				$profile->save();

                                

				Yii::app()->user->setFlash('profileMessage',UserModule::t("Changes is saved."));

				$this->redirect(array('/user/profile'));

			} else $profile->validate();

		}


		$this->render('edit',array(

			'model'=>$model,

			'profile'=>$profile,

		));

	}



I figured it out. When i cleared out the db, i didnt reload the user profile table data, which made it come up empty when it looked for that user profile data.