There is another strange (in my opinion) behavior of saveAll() - as
you can see in my previous post in second parameter I use
'validate'=>'first' to validate all records before save any (as is
described in manual and api).
But even if any of array elements doesn't pass validation, other
elements are stored as well.... Is this a bug or I'm missing something

On Oct 29, 12:52 pm, senser <[email protected]> wrote:
> Hello guys,
>
> 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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to