I need to know how to apply the "matches" validation rule in Kohana 3.1. I've tried the following rule in my model with no success:
'password_confirm' => array(
array('matches', array(':validation', ':field', 'password')),
)
But it always fails. I put a var_dump($array)
in the first line of the Valid::matches() method. I paste it below:
/**
* Checks if a field matches the value of another field.
*
* @param array array of values
* @param string field name
* @param string field name to match
* @return boolean
*/
public static function matches($array, $field, $match)
{
var_dump($array);exit;
return ($array[$field] === $array[$match]);
}
It prints an object of type Validation and if I do var_dump($array[$field])
it prints null
.
Thanks a lot in advance.
UPDATE: Also I figured out by the validation message that the order of the parameters of the rule should be inverted to this:
'password_confirm' => array(
array('matches', array(':validation', 'password', ':field')),
)