Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add overwrite message support to the ValidationResult #78

Closed
wants to merge 7 commits into from
Closed

Add overwrite message support to the ValidationResult #78

wants to merge 7 commits into from

Conversation

rick-nu
Copy link

@rick-nu rick-nu commented Aug 21, 2015

What

This PR adds support to overwrite validation messages on the validation result. This could come in handy overwriting validation messages in a view (when using MVC).

How to test

  1. See that you can overwrite validation messages in the validation result, including message variables
  2. See that you can no longer overwrite specific messages on the validator
  3. See that all tests pass and coverage/quality is still 100%

ToDo

  • Update documentation
  • Remove ->overwriteMessages() from the Validator class.

$this->assertEquals($expected, $result->getMessages());
}

public function testMessagesWillBeInheritedFromDefaultContext()
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer a use-case, since the messages will always be overwritten from the validation result. This decreases the complexity, which is another plus of this feature.

@rick-nu
Copy link
Author

rick-nu commented Aug 27, 2015

Ok, I have an issue with this for the following feature: #80. Now the specific messages are set on the validation result. But in the ->output() function I would like to receive all possible and final validation messages. I need to find a way to set those so that they are available for that function as well. I can't make it part of the ValidationResult, because the validator will have to run ->validate() before you could do a ->output().

@rick-nu
Copy link
Author

rick-nu commented Aug 28, 2015

After a log discussing with @rskuipers we decided that overwriting the messages in a template file is not going to work with functionality like output. Therefor I decided to close this PR, and start to work on the output functionality instead. The validation result class is still a nice improvement, but overwriting the messages still needs to be done on validator level.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant