Skip to content

feat: add array_duplicate_by() helper to get duplicate array by column#8436

Closed
ddevsr wants to merge 3 commits into
codeigniter4:4.5from
ddevsr:array-duplicate-by
Closed

feat: add array_duplicate_by() helper to get duplicate array by column#8436
ddevsr wants to merge 3 commits into
codeigniter4:4.5from
ddevsr:array-duplicate-by

Conversation

@ddevsr
Copy link
Copy Markdown
Collaborator

@ddevsr ddevsr commented Jan 20, 2024

Description
Add array_duplicate_by function to get duplicate array by column.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@ddevsr ddevsr added enhancement PRs that improve existing functionalities docs needed Pull requests needing documentation write-ups and/or revisions. 4.5 labels Jan 20, 2024
@ddevsr ddevsr changed the title feat: get duplicate by column helpers feat: get duplicate array by column helpers Jan 20, 2024
@michalsn
Copy link
Copy Markdown
Member

I wonder about the overall usefulness of this helper method... I'm not entirely convinced, but if others see potential in it, I won't be opposed.

@kenjis
Copy link
Copy Markdown
Member

kenjis commented Jan 20, 2024

I wonder too. Can you show use cases?

Comment thread tests/system/Helpers/ArrayHelperTest.php
Comment thread system/Helpers/array_helper.php
@ddevsr
Copy link
Copy Markdown
Collaborator Author

ddevsr commented Jan 21, 2024

@michalsn @kenjis I have real cases in my project

Used for upload batch by excel, I made this so that when uploading hospital or member master data it immediately rejects duplication without needing to check it from the database. As we all know, to save to the database, doing it by looping and checking in it will take a lot of time.

This result can be show to alert, when creating like 6000 data you dont check by excel again

@michalsn
Copy link
Copy Markdown
Member

@ddevsr I do not doubt that you have a use case for this, but I'm not sure if this is such a common problem to add it to the framework.

@ddevsr ddevsr force-pushed the array-duplicate-by branch from c790683 to 1b65477 Compare January 22, 2024 06:29
@ddevsr
Copy link
Copy Markdown
Collaborator Author

ddevsr commented Jan 22, 2024

@kenjis @michalsn I follow decision core team

@ddevsr ddevsr force-pushed the array-duplicate-by branch from 0ed7b56 to 39d2131 Compare January 22, 2024 09:01
@kenjis kenjis changed the title feat: get duplicate array by column helpers feat: add array_duplicate_by() helper to get duplicate array by column Feb 4, 2024
@kenjis
Copy link
Copy Markdown
Member

kenjis commented Feb 4, 2024

I posted in the forum.
https://forum.codeigniter.com/showthread.php?tid=89308

@kenjis
Copy link
Copy Markdown
Member

kenjis commented Mar 5, 2024

There are more people who disagree.

We would encourage people to use libraries over adding functions to the framework core - especially Helpers since they aren’t easily extensible, replaceable, or portable.

@kenjis kenjis closed this Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs needed Pull requests needing documentation write-ups and/or revisions. enhancement PRs that improve existing functionalities

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants