Reputation: 737
what would be the efficient way of saving the following array using php (cakephp)? each value needs to go into a new row in the table?
Array
(
[0] => 6786754654
[1] => 5643564545
[2] => 344544545
[3] => 233245654654
[4] => 453454654654
[5] => 6546542323
[6] => 654654654
[7] => 645654654
etc....
)
thanks
Upvotes: 0
Views: 2356
Reputation: 4203
2 choices:
I'd recommend option 1 as you can use Model::saveAll($data, array('validate' => 'first')); to ensure that all values are valid before saving any of them.
Upvotes: 4