update multiple records to existing rows

list:

no col1 col2 col3

1 zx ff gg
2 fg hgf hgf

3 gf gf gfh
4 gh hgf g
5 hg hh hg

now my question is how to update 3,4,5 rows in ORM list->update

I don't think there is a way to do a batch update. You'll have to save the model mapping to row 3, then the model mapping to row 4, etc.

Can you post some code that demonstrates what you are trying to do?



1.4k

I too am interested in batch insert/update abilities.

If I have a form submitting the information below...

id name email
42 ABC [email protected]
43 DEF [email protected]
44 GHI [email protected]

...right now I have to loop over the rows and save/update/create individually, with Contact()::findFirst(42)->save($contacts[42]); (or something similar)

What would be desirable might be something like Contact()::saveAll($contacts) and let the ORM find the primary key in the array, or require the array to be indexed by the primary key, and take action from there.

Looping through is quite fast, and we'll probably create a little helper function to handle this, but something built-in might be better optimized.