[Validator] Only return unique messages #4120

Merged
merged 2 commits into from Apr 11, 2013

Projects

None yet

2 participants

@davidwindell

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
Zend Framework 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

Done. 👍

@weierophinney weierophinney added a commit that referenced this pull request Apr 11, 2013
@weierophinney weierophinney Merge branch 'hotfix/4120' into develop
Close #4120
8e991b5
@weierophinney weierophinney merged commit 2d0f6d0 into zendframework:develop Apr 11, 2013

1 check passed

Details default The Travis build passed
@davidwindell davidwindell deleted the davidwindell:validator-unique-messages branch Apr 11, 2013
@ghost Unknown pushed a commit that referenced this pull request Jul 14, 2013
@weierophinney weierophinney Merge branch 'hotfix/4120' into develop
Close #4120
4624ebf
@weierophinney weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge pull request zendframework/zendframework#4120 from davidwindell…
…/validator-unique-messages

[Validator] Only return unique messages
825f640
@weierophinney weierophinney added a commit to zendframework/zend-validator that referenced this pull request May 15, 2015
@weierophinney weierophinney Merge branch 'hotfix/4120' into develop 92c9b0f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment