Skip to content
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

Undocumented $context feature of validator's isValid($value, array $context = null) method #96

Open
tempfirstuser opened this issue Mar 7, 2021 · 0 comments

Comments

@tempfirstuser
Copy link

Feature Request

Q A
New Feature yes
RFC no
BC Break no

Summary

Why $context in validator's method isValid($value, array $context = null) is undocumented feature? Does $context contain safe (filtered, validated) values to use them for query to database?
I needed validator for dependent fields, for, example, pair for username-token: token can be validated only if user exists and found that I can use $context besides 'callback' validator. I have found only one mentioned (just right now) in issues about $context #15 (comment) by @weierophinney .

Also, Metthew have answered to my question: "It's not documented, because it's not part of the validator interface. But the way validation chains work, they always get passed the context, which is the full set of values being validated. That said, they are the raw values, and there's no guarantee they are actually valid. The main purpose for having it passed is to do things like password verification (e.g., ensure the password in a reg form was typed twice identically), or to perform validations based on an aggregation of values (e.g., value is not valid by itself, but only when presented in combination with other values).".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants