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] Add normalizer option to Unique constraint#38488

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

Conversation

henry2778
Copy link
Contributor

QA
Branch?5.x
Bug fix?no
New feature?yes
Deprecations?no
Tickets#37451
LicenseMIT
Doc PRtodo

Hello! Reopening my PR#37507 with target branch5.x

This PR is about#37451. The idea is to make that constraint more flexible and able to process business rules, especially when working with objects. We can think about it as the similar feature in UniqueEntity constraint, when we declare on which attributes we are applying the constraint. But in our case it is more general - we pass a callable with whatever logic we want to apply to collection elements before we apply 'uniqueness check' :)

Looks like no BC breaks. Thanks! :)

OskarStark and derrabus reacted with thumbs up emoji
Copy link
Member

@derrabusderrabus left a comment

Choose a reason for hiding this comment

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

I'm sorry nobody has picked up that PR yet. I think, this change could be a useful addition to the unique validator.

henry2778 reacted with rocket emoji
Copy link
Member

@derrabusderrabus left a comment

Choose a reason for hiding this comment

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

Thanks a lot. We're almost good. 😃

@@ -16,6 +16,14 @@
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase;

class CallableClass
Copy link
Member

Choose a reason for hiding this comment

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

Please declare the test case class first. This fixture class should be moved to the end of the file.

henry2778 reacted with thumbs up emoji
@fabpot
Copy link
Member

@henry2778 Can you have a look at the failing tests? It seems related to the changes here. Thank you.

@henry2778
Copy link
ContributorAuthor

@henry2778 Can you have a look at the failing tests? It seems related to the changes here. Thank you.

thanks! fixed

@derrabusderrabus changed the title[Validator] Add valueNormalizer option to Unique Constraint[Validator] Add normalizer option to Unique constraintMar 17, 2021
@derrabusderrabusforce-pushed thefeature/unique-validator-normalizer-5.x branch from51c36bf to44e1e8bCompareMarch 18, 2021 14:44
@derrabus
Copy link
Member

Thank you@henry2778.

@derrabusderrabus merged commit1c22e6a intosymfony:5.xMar 18, 2021
javiereguiluz added a commit to symfony/symfony-docs that referenced this pull requestMar 27, 2021
…henry2778)This PR was squashed before being merged into the 5.3-dev branch.Discussion----------[Validator] Add normalizer option to Unique constraintHello. Documenting  the featuresymfony/symfony#38488 about `normalizer` option for Unique constraint.1. Updated the intro paragraph mentioning the strict comparison2. Added normalizer to the option list3. Added normalizer option description. There is a include file for that, but since the description is slightly different, I decided not use it.Thanks!Commits-------92072d9 [Validator] Add normalizer option to Unique constraint
@fabpotfabpot mentioned this pull requestApr 18, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@fabpotfabpotfabpot approved these changes

@derrabusderrabusderrabus approved these changes

Assignees
No one assigned
Projects
None yet
Milestone
5.4
Development

Successfully merging this pull request may close these issues.

5 participants
@henry2778@fabpot@derrabus@nicolas-grekas@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp