-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
Register and tag validators in container #49779
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
Conversation
Hey! I see that this is your first PR. That is great! Welcome! Symfony has a contribution guide which I suggest you to read. In short:
Review the GitHub status checks of your pull request and try to solve the reported issues. If some tests are failing, try to see if they are failing because of this change. When two Symfony core team members approve this change, it will be merged and you will become an official Symfony contributor! I am going to sit back now and wait for the reviews. Cheers! Carsonbot |
'alias' => IsbnValidator::class, | ||
]) | ||
|
||
->set('validator.is_false', IsFalseValidator::class) |
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.
Are we sure to want to maintain this big list of services? Maybe the fix should be on the translator component since this is the only issue we founded due to not declared constraints?
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.
I agree with that, this PR is a glimpse of the involvements of a solution going in the way of the original feature taking the postulate that validators were all services
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.
I’m not sure since the issue is proof that validator.constraint_validator
is unreliable. If a fix is applied to the translator component I think this tag would have to be removed.
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.
Alternative solution in the translator component available here
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.
Yeah #49785 feels better indeed; it’s not that validator.constraint_validator
is unreliable, it’s just that unregistered validators cannot be tagged. But would it be possible to still consider it in TranslatorPass
to take userland validators into account?
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.
Answering the question here and closing this PR.
This PR register validators related to a constraints having violation messages as services in container and tag them so the
TranslatorPass
take them into account when extracting constraint messages in attributes.This PR is a first draft with the solution suggested by @MatTheCat in the related ticket.
It will also extract userland constraint messages if validators are declared as service.