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

support customize dot flag of array keys #31

Conversation

messikiller
Copy link
Contributor

In some cases, keys of inputs array has already contain the default dot flag '.', it maybe make user confused while match multiple dimension keys. such as the inputs array:

$data = [
    'foo.bar' => [
        'baz' => 'jax'
    ]
];

so. i append setDotKey() and getDotKey() for the class validation,it is possible if user want to specify another delimiter:

$validation = (new Factory)->make($inputs, $rules);
$validation->setDotKey('/');

@dave-redfern
Copy link
Member

@messikiller Thank you for your PR and my apologies for taking this long to respond.

At this time I am not going to accept your PR. This change represents a fundamental alteration at a low level, that does not have sufficient testing to ensure it works across all aspects of the library. You would need to write tests for every rule and multiple scenarios to ensure compatibility in all contexts.

If you require this functionality, for now, it would be better if you pre-processed the data to be validated and replace dotted keys with another character. Then they can be changed back after validation if needed.

I may consider a change like this in the next major version of the validation library, but for now it is too risky to integrate.

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

Successfully merging this pull request may close these issues.

2 participants