Several Save Commands Without Transactions

Hi,

I was reveiwing user module and in file /user/controllers/AdminController.php

I found Update action with code :


	public function actionUpdate()

	{

		$model=$this->loadModel();

		$profile=$model->profile;

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

		{

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

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

			

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

				$old_password = User::model()->notsafe()->findByPk($model->id);

				if ($old_password->password!=$model->password) {

					$model->password=Yii::app()->controller->module->encrypting($model->password);

					$model->activkey=Yii::app()->controller->module->encrypting(microtime().$model->password);

				}

				$model->save();

				$profile->save();

				$this->redirect(array('view','id'=>$model->id));

			} else $profile->validate();

		}


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

			'model'=>$model,

			'profile'=>$profile,

		));

	}



That raise my doubts that 2 models user/profile saved one after other without any transaction opened.

Related tables are InnoDB and they support transactions. Is it a good practice, as user module is used by many people ?

its a mater of choice I personally like to do this stuff in a transaction, as you may have noticed author is validating the models before the stuff gets saved to the database basically if the data is invalid it wont save sort of like a transaction simulated in php