In one of my models, I have a method to test a PDO connection. I use a try and catch to catch the exception and then I return the connection status (true or false). My try and catch is not working because Yii catches the PDO exception first and uses its own handler to handle the exception.
How can I prevent Yii from handling this exception?
My code:
public static function getConnectionStatus($connectionString, $user, $pwd)
{
try{
$myConnect = new PDO($connectionString, $user, $pwd);
$myConnect = null;
return true;
}
catch (Exception $e){
// Never reach this point. Yii handles the exception?! How do I prevent Yii from doing this?
return false;
}
}