Yii Framework Forum: Yii-Exception missing in Yii::autoloader - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii-Exception missing in Yii::autoloader Rate Topic: -----

#1 User is offline   thyseus 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 302
  • Joined: 18-April 09
  • Location:Leipzig, Germany

Posted 09 November 2009 - 05:02 AM

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:


I get an php error:


PHP Error Description YiiBase::include(Object.php)
[<a href='yiibase.include'>yiibase.include</a>]: failed to open stream: No such file or directory
autoload() #1 unknown(0): autoload() #2

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

<wrong code > 
} { 
catch (Exception $e) { echo $e->getMessage(); 

would display my mistake.


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:


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

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

Or doesn´t it? :)

#2 User is offline   leandrofranca 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 24
  • Joined: 19-January 09
  • Location:Salvador, Bahia, Brasil

Posted 10 December 2009 - 08:29 PM

I have the same problem in Yii 1.0.10...

$transaction = Yii::app()->db->beginTransaction();
		mail($model->email,"Send mail",$theData,$headers);
		Yii::app()->user->setFlash('info','Email has sent!');
catch(Exception $e)

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.

Share this topic:

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users