The format for building the Validation
object directly is different from that of your $_rules
array.
You can see the correct method signature and definition documented here, and it'd probably be a good idea to also read the signature for Validation::rule
.
In short, the rules()
method wants an list of arrays, where for each inner array the first element is the validation function and the second an array of parameters to pass to it.
e.g.
$rules = array(
array('not_empty', NULL),
array('min_length', array(':value', 6))
);
$v = Validation::factory($values)
->rules('fieldname', $rules);
Note that this is different than the $_rules
array (map) format that you are attempting to use where the key is the validation function and the parameters are the values.
Aslo, is there any reason you're building your own validation function instead of using the ORM::rules()
method of validation?