Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Validator] Code property can't be populated to ConstraintViolation#7276

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
aeoris wants to merge7 commits intosymfony:masterfromaeoris:ConstraintViolationCode
Closed

[Validator] Code property can't be populated to ConstraintViolation#7276

aeoris wants to merge7 commits intosymfony:masterfromaeoris:ConstraintViolationCode

Conversation

@aeoris
Copy link
Contributor

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#7273,#9691
LicenseMIT
Doc PRsymfony/symfony-docs#2302

Copy link
Contributor

Choose a reason for hiding this comment

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

Take a look atcontext->addViolation(), I think passing null as the 3rd argument is not equivalent to what was done before, there's a gotcha in the method !

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh! You mean passing$value instead? If so, please tell me and I will change all of them to consider that! Did you detect any other issues?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep this is what I mean (and you should add a unit test for that)

No other issue detected but I only quickly scanned it.

@aeoris
Copy link
ContributorAuthor

Ping@vicb

Did my last couple commits solve the issue you pointed out?

@vicb
Copy link
Contributor

Looks good.
Please use the standard pr header (found on symfony.com). Thanks.

"Diego Agulló"notifications@github.com wrote:

Ping@vicb

Did my last couple commits solve the issue you pointed out?


Reply to this email directly or view it on GitHub:
#7276 (comment)

@aeoris
Copy link
ContributorAuthor

Done! I just don't know whether this is a new feature or a bug fix, so I selected both and made a PR to symfony-docs as well.

@stof
Copy link
Member

you are adding a way to configure the code in the constraint. This is a new feature. I updated the description accordingly

@fabpot
Copy link
Member

ping @bschussek

@webmozart
Copy link
Contributor

@fabpot The implementation of this PR doesn't match the specification in#7273.

@aeoris Do you have time to update this PR?

@aeoris
Copy link
ContributorAuthor

@bschussek Haven't forgot this issue, and I'm happy to say that I finally have time enough to give it a go. I'm on it!

…onCodeConflicts:src/Symfony/Component/Validator/Constraints/CountryValidator.phpsrc/Symfony/Component/Validator/Constraints/LanguageValidator.phpsrc/Symfony/Component/Validator/Constraints/LocaleValidator.phpsrc/Symfony/Component/Validator/Constraints/MaxLengthValidator.phpsrc/Symfony/Component/Validator/Constraints/MaxValidator.phpsrc/Symfony/Component/Validator/Constraints/MinLengthValidator.phpsrc/Symfony/Component/Validator/Constraints/MinValidator.php
@aeoris
Copy link
ContributorAuthor

@bschussek can you please check whether this PR matches#7273 now? Thanks!

@cordoval
Copy link
Contributor

@aeoris could you please add to the description table that it fixes#9691 please ? 👶

@aeoris
Copy link
ContributorAuthor

@cordoval done, thanks!

@cordoval
Copy link
Contributor

👍 just make sure you have not missed testing each of those codes i guess? also how are you generating the codes, so that in future additions is clear how you are generating those codes. Thanks.

@aeoris
Copy link
ContributorAuthor

@cordoval I'll double check the tests as soon as I get back home next Monday.

The codes are RFC 4122-compliant 128 bit random values as proposed here by @bschussek:#7273 (comment)

@aeoris
Copy link
ContributorAuthor

@cordoval I did indeed miss three code checks, but those are fixed now.

@stloyd
Copy link
Contributor

@fabpot@webmozart Could you have a look at this?

@aeoris
Copy link
ContributorAuthor

@webmozart any progress on this?

webmozart added a commit that referenced this pull requestAug 19, 2014
… (webmozart)This PR was merged into the 2.6-dev branch.Discussion----------[Validator] Added ConstraintViolation::getConstraint()| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#5050| License       | MIT| Doc PR        | -This PR adds a `getConstraint()` method to the `ConstraintViolation` in order to access the constraint causing the violation.Related to#7276,#7273 and#9691.Commits-------ce1d209 [Validator] Added ConstraintViolation::getConstraint()
@webmozart
Copy link
Contributor

Replaced by#12005.

fabpot added a commit that referenced this pull requestSep 25, 2014
This PR was merged into the 2.3 branch.Discussion----------[Validator] Simplified testing of violations| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets | -| License       | MIT| Doc PR        | -I simplified the assertion of violations in preparation of a replacement PR for#7276.Commits-------8e5537b [Validator] Simplified testing of violations
webmozart added a commit that referenced this pull requestSep 30, 2014
…multiple error causes (webmozart)This PR was merged into the 2.6-dev branch.Discussion----------[Validator] Added error codes to all constraints with multiple error causes| Q             | A| ------------- | ---| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#7276| License       | MIT| Doc PR        | TODOThis PR depends on#12015 and#12016 being merged first. However, a few changes in52cb7df first must be backported to#12016.This PR introduces error codes for all constraints with multiple error paths. This lets you determine what exactly the reason was that a constraint failed:```php$validator = Validation::createValidator();$violations = $validator->validate('0-4X19-92619812', new Isbn());foreach ($violations as $violation) {    var_dump($violation->getCode());    // => int(3)    var_dump(Isbn::getErrorName($violation->getCode()));    // => string(24) "ERROR_INVALID_CHARACTERS"    var_dump($violation->getConstraint()->getErrorName($violation->getCode()));    // => string(24) "ERROR_INVALID_CHARACTERS"}```The `getErrorName()` method is especially helpful for REST APIs, where you can return both an error code and a description of that error now.**Todos**- [x] Backport a few structural changes to#12016- [x] Update constraints outside of the Validator component- [x] Rebase on master (after merging#12015 and#12016)Commits-------3b50bf2 [Validator] Added error codes to all constraints with multiple error causes
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@aeoris@vicb@stof@fabpot@webmozart@cordoval@stloyd

[8]ページ先頭

©2009-2025 Movatter.jp