Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

[Validator] Only return unique messages #4120

Merged
merged 2 commits into from Apr 11, 2013

Conversation

Projects
None yet
2 participants
Contributor

davidwindell commented Mar 26, 2013

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.

Owner

weierophinney commented Mar 28, 2013

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.

Contributor

davidwindell commented Apr 4, 2013

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

1 check passed

default The Travis build passed
Details

@davidwindell davidwindell deleted the davidwindell:validator-unique-messages branch Apr 11, 2013

weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015

Merge pull request zendframework/zendframework#4120 from davidwindell…
…/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 join this conversation on GitHub. Already have an account? Sign in to comment