Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.6k
[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
[Validator] Add normalizer option to Unique constraint#38488
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e4ed9f6
to3205952
CompareThere was a problem hiding this 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.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
db37354
to00b2a49
CompareThere was a problem hiding this 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. 😃
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
@@ -16,6 +16,14 @@ | |||
use Symfony\Component\Validator\Exception\UnexpectedValueException; | |||
use Symfony\Component\Validator\Test\ConstraintValidatorTestCase; | |||
class CallableClass |
There was a problem hiding this comment.
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.
src/Symfony/Component/Validator/Tests/Constraints/UniqueValidatorTest.php OutdatedShow resolvedHide resolved
Uh oh!
There was an error while loading.Please reload this page.
602ed32
to03b91f7
CompareUh oh!
There was an error while loading.Please reload this page.
@henry2778 Can you have a look at the failing tests? It seems related to the changes here. Thank you. |
thanks! fixed |
51c36bf
to44e1e8b
CompareThank you@henry2778. |
…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
Hello! Reopening my PR#37507 with target branch
5.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! :)