Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Validator] Add simple helper ConstraintViolationList::hasViolation #33229

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

Closed
wants to merge 4 commits into from
Closed

[Validator] Add simple helper ConstraintViolationList::hasViolation #33229

wants to merge 4 commits into from

Conversation

ismail1432
Copy link
Contributor

@ismail1432 ismail1432 commented Aug 18, 2019

Q A
Branch? 5
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? /no
Tests pass? ?
Fixed tickets #33230
License MIT
Doc PR symfony/symfony-docs#...

I know that is not the PR of the century but I would like to add an helper to check if a ConstraintViolationList contains or not violation.

At the moment we have to do this to check if ConstraintViolationList has some errors,

if (0 !== count($violations)) {

This is what is done in doc and Api Platform and I would like to replace it by

if($violations->hasViolation())

It's better to reading and easier to be implemented with IDE autocompletion (for newcomers) that are not familiar with the Validator component.

@OskarStark
Copy link
Contributor

Hi Ismail 👋
This is a duplicate of #23493 and references #32733, too.

@fabpot
Copy link
Member

fabpot commented Aug 19, 2019

Closing for the reasons I gave in the linked ticket.

@fabpot fabpot closed this Aug 19, 2019
@ismail1432
Copy link
Contributor Author

Ok, Thanks

@ismail1432 ismail1432 deleted the add-helper-count-violations branch August 19, 2019 11:09
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.

4 participants