I'm trying to create a custom function to validate multiple fields in kohana 3.2 orm model.
I know that there's a lot of examples showing how to do this from the controller but I want to set it up in the orm model.
I'm trying to do something like this:
public function rules()
{
return array(
'my_field' => array(
array(array($this, 'my_function')),
),
);
}
public function my_function(Validation $validation, $my_field)
{
//Some calculation and then return error..
$validation->add_error($my_field, 'my_field_not_valid');
}