Hi,

You need to use saveAll(), have a look at
http://book.cakephp.org/view/1032/Saving-Related-Model-Data-hasOne-hasMany-belongsTo

Hope this helps.

Amit Badkas

PHP Applications for E-Biz: http://www.sanisoft.com



On Wed, Jan 19, 2011 at 5:00 PM, Jens Dittrich <[email protected]> wrote:

> Hello!
>
> I want to manipulate an array that I get from a form. The situation is
> as follows:
> People hasMany MobilePhones
>
> The form is for creating a new Person with some MobilePhone numbers at
> once. So neither Person nor MobilePhone have an ID.
> I want to save the Person and the corresponding MobilePhone numbers in
> a single transaction. But what is the best way to set the person_id in
> each of the MobilePhone's in the array?
> Go with an foreach and to use Set::insert()?
> build and array for it and to use Set::pushDiff()?
>
> Anyone got an Idea?
>
> regards,
> Jens
>
> --
> Our newest site for the community: CakePHP Video Tutorials
> http://tv.cakephp.org
> Check out the new CakePHP Questions site http://ask.cakephp.org and help
> others with their CakePHP related questions.
>
>
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php
>

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to