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

Required validator does not apply to array type inputs #308

Closed
hslimen opened this issue Apr 15, 2020 · 1 comment
Closed

Required validator does not apply to array type inputs #308

hslimen opened this issue Apr 15, 2020 · 1 comment

Comments

@hslimen
Copy link

hslimen commented Apr 15, 2020

private function foreach_call_validator(string $rule, string $field, array $input, array $rule_params = [])
{
    $values = !is_array($input[$field]) ? [ $input[$field] ] : $input[$field];

    foreach ($values as $value) {
        $result = $this->call_validator($rule, $field, $input, $rule_params, $value);
        if (is_array($result)) {
            return $result;
        }
    }

    return true;
}

can that solve the problem ?

    $values = !is_array($input[$field]) ? [ $input[$field] ] : [$field => $input[$field]];
@filisko
Copy link
Collaborator

filisko commented Apr 18, 2020

what are your filters and what is your input? $filters / $data

@filisko filisko closed this as completed Apr 24, 2020
@filisko filisko reopened this Apr 24, 2020
@filisko filisko closed this as completed May 5, 2020
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