Yii-Exception missing in Yii::autoloader

Hi, everyone.

The Yii-Autoloader is missing an simple,important Exception.

Let´s assume an Object is not available in the filesystem, for example models/Object.php.

Now i call:


Object::model()->findByPk(1);

I get an php error:

Instead of this, it would be better an Exception would be raised:


 try{ 

<wrong code > 

} { 

catch (Exception $e) { echo $e->getMessage(); 

}

would display my mistake.

Update:

It would also be fine if yii would raise an exception when i fail to parameterize all placeholders in CDbCriteria, an example:


 $criteria->condition='user_id = :user_id'; 

           $criteria->params = array('userid' => 1); 

here the _ and (optional) the : is missing in the $criteria->params.

I get the following error:

which would also be more elegant in an Exception, something like "warning: not all placeholders have been parameterized" or something.

Or doesn´t it? :)

I have the same problem in Yii 1.0.10…




$transaction = Yii::app()->db->beginTransaction();

try

{

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

	if($model->save())

	{

		....

		mail($model->email,"Send mail",$theData,$headers);

		Yii::app()->user->setFlash('info','Email has sent!');

	}

	$transaction->commit();

}

catch(Exception $e)

{

	$transaction->rollBack();

	Yii::app()->user->setFlash('info',$e->getMessage());

}



The above code generate a Php Error page with the stacktrace but the transaction in try/catch doesn’t work the model was saved and the email was not sent.

The error was caused by me “Failed to connect to mailserver” to simulate one real exception. But the transaction don’t work.