Hello,
I have the following router converter defined:
$router->addGet(...)
->convert('southWest', function($southWest) {
$sw = explode(',', $southWest);
try{
$p = new Point($sw[0], $sw[1]);
} catch(Exception $e) {
//Impossible to create instance of Point and senseless to use default values
$p = NULL
}
return $p;
});
The parameter (Point) will be passed to the following controller method:
public function fooAction(Point $southWest) {
...mycode
}
In case of an Exception inside the converter, $p = NULL will be returned and then passed to fooAction. Unfortunately then a Catchable fatal error will be thrown by PHP.
Now my questions:
Is it possible to redirect to another action before fooAction will be called with a invalid parameter ? Is it possible to catch the fatal error and call another action? If yes, where should that be done?