Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

[Validator] Only return unique messages #4120

Merged

Conversation

davidwindell
Copy link
Contributor

If you have an input like so;

$this->add(array(
    'name' => 'email',
    'required' => false,
    'validators' => array(
        array(
            'name' => 'EmailAddress',
            'options' => array(
                'message' => 'That is not a valid email address',
            )
        ),
    )
));

Users will see (on a form for example);

  • That is not a valid email address
  • That is not a valid email address
  • That is not a valid email address

i.e. the same error three times.

Here we simply return only unique error messages.

There are a few test errors as some tests assume that identical errors will be returned, can I get some opinions on this concept please.

@weierophinney
Copy link
Member

Approach looks reasonable; I'd like to see tests with varying numbers of messages, including both duplicates and uniques. Once those are in place, I think we can merge.

@davidwindell
Copy link
Contributor Author

Done. 👍

@ghost ghost assigned weierophinney Apr 11, 2013
weierophinney added a commit that referenced this pull request Apr 11, 2013
weierophinney added a commit that referenced this pull request Apr 11, 2013
@weierophinney weierophinney merged commit 2d0f6d0 into zendframework:develop Apr 11, 2013
@davidwindell davidwindell deleted the validator-unique-messages branch April 11, 2013 15:50
weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
…/validator-unique-messages

[Validator] Only return unique messages
weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants