I'm trying to use Model->saveAll() in one of my projects for saving
multiple model records (not associations). Hera is structured data I
try to save:
Array
(
[Email] => Array
(
[0] => Array
(
[email_id] => 8
[employee_mailbox_id] => 77
[notes] =>
)
[1] => Array
(
[email_id] => 8
[employee_mailbox_id] => 5
[notes] =>
)
[2] => Array
(
[email_id] => 8
[employee_mailbox_id] => 1
[notes] =>
)
)
As you can see model name is "Email" and I want to store three records
in corresponding table at once with following controller code:
$this->Email->create($data['Email']); $result=$this->Email->saveAll
($data['Email'], array('validate'=>'first', 'atomic'=>false));
My confusion is caused by the return value ot saveAll function - it is
array containing 5 elements but not 3. Elements with value 1 for
succeeded elements and 0 for unsuccessful stored elements suppose.
Am I wrong or missing something and how can I retrieve what elements
are stored successfully and what are failed.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment