bmidget/kohana-formo — Issue #160: Formo doesn't catch ORM_Validation_Exception
Author: d4rky-pl
Created: 2011-12-30 09:26:29+00:00
State: open

As far as I understand, Formo has it's own error-handling system. However in the latest version from repository, it doesn't catch errors from ORM, and rather than that, it allow ORM_Validation_Exception to be uncaught.

Example code:

try
{
if($form->load($_POST)->validate()) // <- THIS
{
if($this->_create_passed($form, $element))
{
$element->save();
$form->orm('save_rel', $element);

$this->request->redirect(Route::get($this->_route_name)->uri(array('controller'=> Request::current()->controller())));
}
}
else
{
$this->_create_failed($form, $element);
}
}
catch(ORM_Validation_Exception $e)
{
echo Debug::vars($e->errors());
}

Returns:

array(1) (
"id" => array(2) (
0 => string(9) "not_empty"
1 => array(1) (
0 => NULL
)
)
)