Why transaction no commit ??

i use code

controler


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

		{

			$transaction=$modelcontact->dbConnection->beginTransaction();

			try

			{

			//validation scenario jika ceckbox company/employee di isi.

			$_POST['TbContact']['iscompany']==TRUE?$modelcontact->setScenario('iscompany'):'';

			$_POST['TbContact']['isemployee']==TRUE?$modelcontact->setScenario('isemployee'):'';

			$_POST['TbContact']['isemployee']==TRUE and $_POST['TbContact']['iscompany']==TRUE?$modelcontact->setScenario('isemployeeiscompany'):'';

			if($_POST['TbContact']['isemployee']==TRUE)

			{

				//ajax validation tb_contact dan tb_employee

				$this->performAjaxValidation(array($modelemployee,$modelcontact));

			}else{

				//ajax validation tb_contact

				$this->performAjaxValidation(array($modelcontact));

			}

			//jika date di contact kosong

			if(empty($_POST['TbContact']['birthday']))

			{$_POST['TbContact']['birthday']=null;}

			if(empty($_POST['TbContact']['maritaldate']))

			{$_POST['TbContact']['maritaldate']=null;}

			//mengambil postingan dimasukan kedalam attributes

			$_POST['TbContact']['isemployee']==FALSE?:'';

            $modelcontact->attributes=$_POST['TbContact'];

			$imageurl=CUploadedFile::getInstance($modelcontact,'imageurl');

			$modelcontact->imageurl=$imageurl;

            if($modelcontact->save())

            {

            	if($imageurl!=NULL)

			 	{

					$modelcontactimage=TbContact::model()->findByPk($modelcontact->contactid);

					$imagename=$modelcontact->contactid."-photo.jpeg";

					$modelcontactimage->imageurl=$imagename;

					$modelcontactimage->save();

					$imageurl->saveAs(Yii::app()->basePath . '/../images/contact/' .$imagename);

                }

				//save ke tb_contact_person

                if(isset($_POST['TbContact']['contactperson']) and isset($_POST['TbContact']['iscompany']))

                {

                	foreach($_POST['TbContact']['contactperson'] as $row)

                	{

						$modelcontactpersonloop[$row]=new TbContactPerson;

					  	$modelcontactpersonloop[$row]->contactidcompany=$row;

						$modelcontactpersonloop[$row]->contactidindividual=$modelcontact->contactid;

						$modelcontactpersonloop[$row]->save();

                    }

                }

				echo"<br><br><br><br>commit";

				$transaction->commit();

				

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

            }

            if($_POST['TbContact']['isemployee']==TRUE)

            {

				//jika date di employee kosong

		        if(empty($_POST['TbEmployee']['startdate']))

		        {$_POST['TbEmployee']['startdate']=null;}

		        if(empty($_POST['TbEmployee']['joindate']))

		        {$_POST['TbEmployee']['joindate']=null;}

		        if(empty($_POST['TbEmployee']['enddate']))

		        {$_POST['TbEmployee']['enddate']=null;}

		        if(empty($_POST['TbEmployee']['resigndate']))

		        {$_POST['TbEmployee']['resigndate']=null;}

				//mengambil fungsi upload dan memasukan name file ke tb_employee

                $modelemployee->contactid=$modelcontact->contactid;

                $modelemployee->attributes=$_POST['TbEmployee'];

				$employeeapplicationfile=CUploadedFile::getInstance($modelemployee,'employeeapplicationfile');

				$modelemployee->employeeapplicationfile=$employeeapplicationfile;

				$employeestudycertificatefile=CUploadedFile::getInstance($modelemployee,'employeestudycertificatefile');

				$modelemployee->employeestudycertificatefile=$employeestudycertificatefile;

				$employeeidentitycardfile=CUploadedFile::getInstance($modelemployee,'employeeidentitycardfile');

				$modelemployee->employeeidentitycardfile=$employeeidentitycardfile;

				$employeefamilycardfile=CUploadedFile::getInstance($modelemployee,'employeefamilycardfile');

				$modelemployee->employeefamilycardfile=$employeefamilycardfile;

				$employeepolicecardfile=CUploadedFile::getInstance($modelemployee,'employeepolicecardfile');

				$modelemployee->employeepolicecardfile=$employeepolicecardfile;

				$employeetemporaryidentitycardfile=CUploadedFile::getInstance($modelemployee,'employeetemporaryidentitycardfile');

				$modelemployee->employeetemporaryidentitycardfile=$employeetemporaryidentitycardfile;

				$employeecompanycertificatefile=CUploadedFile::getInstance($modelemployee,'employeecompanycertificatefile');

				$modelemployee->employeecompanycertificatefile=$employeecompanycertificatefile;

				//menyimpan ke TbEmployee

                if($modelemployee->save())

                {

					$modelemployeeimage=TbEmployee::model()->findByPk($modelcontact->contactid);

					//upload gambar ke tb employee

					if($employeeapplicationfile!=NULL)

			 		{

						$imagenameemployeeapplicationfile=$modelcontact->contactid."-employeeapplicationfile.jpeg";

						$modelemployeeimage->employeeapplicationfile=$imagenameemployeeapplicationfile;

						$employeeapplicationfile->saveAs(Yii::app()->basePath . '/../images/employee/employeeapplicationfile/' .$imagenameemployeeapplicationfile);

                    }

					if($employeestudycertificatefile!=NULL)

			 		{

						$imagenameemployeestudycertificatefile=$modelcontact->contactid."-employeestudycertificatefile.jpeg";

						$modelemployeeimage->employeestudycertificatefile=$imagenameemployeestudycertificatefile;

						$employeestudycertificatefile->saveAs(Yii::app()->basePath . '/../images/employee/employeestudycertificatefile/' .$imagenameemployeestudycertificatefile);

                    }

					if($employeeidentitycardfile!=NULL)

			 		{

						$imagenameemployeeidentitycardfile=$modelcontact->contactid."-employeeidentitycardfile.jpeg";

						$modelemployeeimage->employeeidentitycardfile=$imagenameemployeeidentitycardfile;

						$employeeidentitycardfile->saveAs(Yii::app()->basePath . '/../images/employee/employeeidentitycardfile/' .$imagenameemployeeidentitycardfile);

                    }

					if($employeefamilycardfile!=NULL)

			 		{

						$imagenameemployeefamilycardfile=$modelcontact->contactid."-employeefamilycardfile.jpeg";

						$modelemployeeimage->employeefamilycardfile=$imagenameemployeefamilycardfile;

						$employeefamilycardfile->saveAs(Yii::app()->basePath . '/../images/employee/employeefamilycardfile/' .$imagenameemployeefamilycardfile);

                    }

					if($employeepolicecardfile!=NULL)

			 		{

						$imagenameemployeepolicecardfile=$modelcontact->contactid."-employeepolicecardfile.jpeg";

						$modelemployeeimage->employeepolicecardfile=$imagenameemployeepolicecardfile;

						$employeepolicecardfile->saveAs(Yii::app()->basePath . '/../images/employee/employeepolicecardfile/' .$imagenameemployeepolicecardfile);

                    }

					if($employeetemporaryidentitycardfile!=NULL)

			 		{

						$imagenameemployeetemporaryidentitycardfile=$modelcontact->contactid."-employeetemporaryidentitycardfile.jpeg";

						$modelemployeeimage->employeetemporaryidentitycardfile=$imagenameemployeetemporaryidentitycardfile;

						$employeetemporaryidentitycardfile->saveAs(Yii::app()->basePath . '/../images/employee/employeetemporaryidentitycardfile/' .$imagenameemployeetemporaryidentitycardfile);

                    }

					if($employeecompanycertificatefile!=NULL)

			 		{

						$imagenameemployeecompanycertificatefile=$modelcontact->contactid."-employeecompanycertificatefile.jpeg";

						$modelemployeeimage->employeecompanycertificatefile=$imagenameemployeecompanycertificatefile;

						$employeecompanycertificatefile->saveAs(Yii::app()->basePath . '/../images/employee/employeecompanycertificatefile/' .$imagenameemployeecompanycertificatefile);

                    }

					$modelemployeeimage->save();

					//menyimpan ke tb_user_account

					$modeluseraccount->username=$modelemployee->emailname;

				    $modeluseraccount->password=md5($modelcontact->firstname).sha1($modelcontact->firstname);

				    $modeluseraccount->contactid=$modelcontact->contactid;

				    $modeluseraccount->createddate=$modelcontact->createddate;

				    $modeluseraccount->save();

					

                    if(isset($_POST['TbEmployee']['jobtitle']))

                    {

                        foreach($_POST['TbEmployee']['jobtitle'] as $rowjobtitle)

                        {

							//menyimpan ke TbEmployeeJobAssignment

							$modeljobassignment[$rowjobtitle]=new TbEmployeeJobAssignment;

							$modeljobassignment[$rowjobtitle]->contactid=$modelcontact->contactid;

							$modeljobassignment[$rowjobtitle]->employeeid=$modelemployee->employeeid;

							$modeljobassignment[$rowjobtitle]->jobtitlelistid=$rowjobtitle;

							$modeljobassignment[$rowjobtitle]->assignmentdate=$modelcontact->createddate;

							$modeljobassignment[$rowjobtitle]->isactive=TRUE;

							$modeljobassignment[$rowjobtitle]->save();

							//mengupdate TbJobTitleList isused=TRUE

							$modeljobtitlelist[$rowjobtitle]=TbJobTitleList::model()->findByPk($rowjobtitle);

							$modeljobtitlelist[$rowjobtitle]->isusedbyemployeeid=$modelemployee->employeeid;

							$modeljobtitlelist[$rowjobtitle]->save();

							//menyimpan ke TbUserGroupAccount

							$modeluseraccountgroup[$rowjobtitle]=new TbUserGroupAccount;

							$modeluseraccountgroup[$rowjobtitle]->username=$modelemployee->emailname;

							$modeluseraccountgroup[$rowjobtitle]->ugid=$modeljobtitlelist[$rowjobtitle]->usergroupid;

							$modeluseraccountgroup[$rowjobtitle]->save();

                        }

                    }

					//menyimpan ke tb_employee_family

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

					{

						$count=count($_POST['TbEmployeeFamily']);

						for($i=0; $i<$count; $i++)

						{	

							$modelloopfamily[$i]=new TbEmployeeFamily;

							if(empty($_POST['TbEmployeeFamily'][$i]['employeefamilybirthdate']))

		        			{$_POST['TbEmployeeFamily'][$i]['employeefamilybirthdate']=null;}

							$modelloopfamily[$i]->employeeid=$modelemployee->employeeid;

							$modelloopfamily[$i]->attributes=$_POST['TbEmployeeFamily'][$i];

							$modelloopfamily[$i]->save($i);

						}

					}

					$transaction->commit();

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

                }

why it when I submit no commit ??

something wrong with my code ???

is it full version of the code? My editor says "Expected: catch clause"

any errors?

What editor do you use?

phpstorm, anyway I can’t see catch for try