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

new array helper: array_flatten_with_dots #4184

Merged
merged 2 commits into from
Jan 29, 2021

Conversation

paulbalandan
Copy link
Member

Each pull request should address a single issue and have a meaningful title.

Description
Supersedes and closes #4166 .

This PR introduces a new array helper, array_flatten_with_dots, to flatten multidimensional arrays using the dot syntax. This is useful for validations involving multi-keys just like the predicament in the linked PR, if_exist validation.

to @jahmedk, can you test this one to see if it will solve your issue. I've tested this locally with your test script and the error message is now showing.

Checklist:

  • Securely signed commits
  • Component(s) with PHPdocs
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@sfadschm
Copy link
Contributor

sfadschm commented Jan 29, 2021

I like this.
How about a little recursion for arrays with more than two levels?
Nevermind ...

Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handy function! I would like to see a data provider for the test with some more fringe cases, for example an empty string key.

system/Validation/Validation.php Outdated Show resolved Hide resolved
@jahmedk
Copy link

jahmedk commented Jan 29, 2021

@paulbalandan Thanks it's working :)

@paulbalandan paulbalandan merged commit 49520c7 into codeigniter4:develop Jan 29, 2021
@paulbalandan paulbalandan deleted the if-exist-validation branch January 29, 2021 18:16
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.

4 participants