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

Using validators with ArrayObject's offsetSet? #889

Closed
PatrickSJ opened this issue Nov 23, 2017 · 1 comment
Closed

Using validators with ArrayObject's offsetSet? #889

PatrickSJ opened this issue Nov 23, 2017 · 1 comment

Comments

@PatrickSJ
Copy link

Let's say I have a list of rules for all of the attributes of an object:
Validator::key('attr_1', Validator::rule_1()->rule_2()->rule_3()) ->key('attr_2, Validator::rule_1()->rule_2()->rule_3())

Now, if I want to validate the entire object that's all well and good, but with PHP's ArrayObject (and other classes implementing ArrayAccess) you can go things like $obj['attr_1'] = 'foo'. However, in situations where I'm doing this I can't validate since ALL rules are being evaluated.

What if not everything is set yet? I do want exceptions thrown if an invalid value is set for a specific attribute, but I do not want to check all of the rules.

Is there a way to check only the rules for a specific key if all of the keys and their rules have been predefined?

@PatrickSJ PatrickSJ changed the title Using validators with ArrayObject's offsetSet Using validators with ArrayObject's offsetSet? Nov 23, 2017
@henriquemoody
Copy link
Member

With so many open issues, it's become hard to really know what's really important and what I have fixed already.

I'm closing issues that are too old, and I'm not really looking at them all. If this is still relevant, please comment here and I will reopen this issue.

Thanks for reporting! 🐼

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

No branches or pull requests

2 participants