Loadmodel for two or more related tables

hi! i have a problem in my actionUpdate and loadmodel function when i update a form with relations. There is no problem with my actioncreate. The loadmodel should point to all related tables.

public function actionUpdate($id)


	$model = $this->loadModel($id);

	$account = $this->loadModel($id);

	$student = $this->loadModel($id);

	$faculty = $this->loadModel($id);

	// Uncomment the following line if AJAX validation is needed

	// $this->performAjaxValidation($model);
















public function loadModel($id)





		throw new CHttpException(404,'The requested page does not exist.');

	return $model;


sorry i’m just new to yii.

Please see the usage of with() - http://www.yiiframework.com/doc/api/1.1/CActiveRecord#with-detail


then once you assign

$model = $this->loadModel($id);

you should access student and account information via $model->PatronAccount->username;

The above usage is just an example you should use the attributes you’ve declared in each model.