Issues

ZF-7153: Add array handling to all validators and filters

Description

The constructor of all filters and validators have to be reworked to use one single array as input.

This allows the usage of ini files without the need of keeping care of the order of the parameters. Additionally this unifies the usage for all validators and filters as it is then easily possible to extend them with new parameters without changing the API.

Example: new Zend_Validate_StringLength($min, $max);

Switched parameters makes problems when using INI or Zend_Form.

New behaviour: new Zend_Validate_StringLength(array('min' => $min, 'max' => $max));

Comments

r18028 implements array and Zend_Config support to all validators.

Added support also to all filters.

I looked into http://framework.zend.com/code/browse/…, because i had the idea of implementing an ConstraintsTemplate array into Zend_Validate_Abstract, which seemed problematic because of missing this Array Argument Support.

Now i saw just another possible improvement: Wouldn't it be more economical to implement the __construct() method within Zend_Validate_Abstract, setting the values based on existance of an appropriate Setter Method in the individual Validators, and based on the StringLength example above move any Requirement Logic into the isValid() Method?

With Requirement Logic i mean this:

if (!array_key_exists('min', $options)) { $options['min'] = 0; }

That would also lead to an easy extensibility of Zend_Validate_Abstract like setting constraintTemplates through the config when instantiating any Validator and fetching them afterwards with a getConstraints() implemented in Zend_Validate_Abstract.

Please forgive if this was not the right place to put it in.