CodeIgniter Forums
nice to have before and after for insertBatch - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Feature Requests (https://forum.codeigniter.com/forum-29.html)
+--- Thread: nice to have before and after for insertBatch (/thread-80989.html)



nice to have before and after for insertBatch - Anwar - 01-11-2022

Hello, 
Would be nice to have in modal's beforeInsertBatch and afterInsertBatch. I'm seeing insertBatch very usefull for large imports and having also the ability to manipultate the data before inserting would be a great thing. 
In this moment I'm using db->insert() just because I have afterInsert hook, and takes 18 seconds to do it from a loop. while with insertBatch I get 600ms response time. 
Thank you


RE: nice to have before and after for insertBatch - MGatner - 01-17-2022

Great idea! I could see that being highly useful. I don’t think this would be difficult to add, seeing as all the code is already there it just needs to be adapted for the “batch” methods. Would you be willing to try creating a Pull Request?