MainelyDesign.com Blog

Saveall Tagged Blog Posts

saveAll() to save multiple records in 1 model

Posted on 04/17/2009 at 09:58 am | Viewed 18,992 times | 0 comments

I ran into another issue on something I thought would be simple: saving multiple records with the saveAll() command.  In case you don't know about it, saveAll() is one of the best functions in CakePHP.  It automatically supports transactions, HABTM saves, and certainly saves a lot of typing for almost every type of save you want to do.

Importing an Excel file into CakePHP

Posted on 04/16/2009 at 02:42 pm | Viewed 33,754 times | 0 comments

I needed to be able to upload an excel file, parse the file, and then add each row as a separate database entry.  I had this working for a CSV file using the php built-in function fgetcsv(), but the client switched to using an excel file (instead of direct PHP access to the in-house database, we decided to have the client upload a CSV/Excel file). 

Full Tag List

Meet Site Avenger - Hosted Content Management System

Powered By: Site Avenger | Site Production: Saco Design