CodeIgniter4
CodeIgniter4 copied to clipboard
feat: add `array_duplicate_by()` helper to get duplicate array by column
Description
Add array_duplicate_by function to get duplicate array by column.
Checklist:
- [x] Securely signed commits
- [x] Component(s) with PHPDoc blocks, only if necessary or adds value
- [x] Unit testing, with >80% coverage
- [ ] User guide updated
- [x] Conforms to style guide
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.
I wonder too. Can you show use cases?
@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
@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.
@kenjis @michalsn I follow decision core team
I posted in the forum. https://forum.codeigniter.com/showthread.php?tid=89308
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.