-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Validator] Validate from within Expression #11940
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
Comments
I have no experience with that validator, but the example provided looks like a good example for DX. 👍 |
The only thing that doesn't convince me is the method name /**
* @Expression("valid(this.author) or valid(this.creator)", message="...")
*/
/**
* @Expression("isValid(this.author) or isValid(this.creator)", message="...")
*/ |
@javiereguiluz Yes, this would go along nicely with what is proposed in #11939. |
Adding such a function is a good idea. 👍 |
|
Would be consistent with |
Thank you for this suggestion. |
Putting labels "Help wanted" and "Good first issue" on this one. Anyone willing to give it a try? |
I was surprised there's an open issue from 7 years ago. May I try to handle it? |
@yahya09 sure! I'd be happy to help during review! |
Is this still Open? Anyone on it, otherwise I'd like to make a crack at it! |
@HotScottPtII There already is #47153 which tries to implement this feature. |
The issue #11586 could be solved by providing a
valid()
method in the Expression constraint (as alias for$context->getValidator()->validate()
, but returning a boolean):Additionally, a "constraints" option could be added which allows to pass constraints that can be used within the expression:
Opinions?
The text was updated successfully, but these errors were encountered: