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

feature request: filtering multidemisional arrays #52

Open
agborkowski opened this issue Jan 16, 2015 · 2 comments
Open

feature request: filtering multidemisional arrays #52

agborkowski opened this issue Jan 16, 2015 · 2 comments

Comments

@agborkowski
Copy link

somethik like in valitron lib.

eg. https://github.com/vlucas/valitron

You may use dot syntax to access members of multi-dimensional arrays, and an asterisk to validate each member of an array:
...
$v->rule('max', 'settings.*.threshold', 100);
@guywithnose
Copy link

While it's not as elegant this library already supports this:

$input = ['settings' => ['foo' => ['threshold' => 100]]]; //Passes
$input = ['settings' => ['foo' => ['threshold' => 101]]]; //Fails
$input = ['settings' => [['threshold' => 100]]]; //Passes
$input = ['settings' => [['threshold' => 101]]]; //Fails
$filters = ['settings' => [['array'], ['ofArrays', ['threshold' => [['int', false, null, 100]]]]]];
list($status, $parameters, $error) = Filterer::filter($filters, $input);

@agborkowski
Copy link
Author

anyway sounds good! thanx for tip ! 🍻

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