My goal is to validate parameters passed in the URL, so I created a validate method that has a list of validators to run, like so:
$validators = array(
'number' => array(
'digits',
'presence' => 'required',
'messages' => array(
"%value%' is not a valid number.",
),
),
'country' => array(
'presence' => 'required',
'InArray' => array('haystack' => array('USA', 'CAN', 'AUS', 'JPN')),
'messages' => array(
"'%value%' is not a valid country code.",
),
),
// etc.
);
$valid = new Zend_Filter_Input(array(), $validators, $data);
return $valid->isValid()
The issue is that the 'InArray' validator does nothing. It doesn't raise any errors, it just doesn't work. I assume that I'm getting the syntax wrong.
What is the correct syntax for the 'InArray' validator?