I don't use saveAll much myself but oen thing you can look into is the
phrasing that explains what it does.
I remember reading that saveAll can save multiple records of a single
model OR one record and multiple related Models. I am not sure it ca
do both at the same time the way you are trying.

If you find that it can't then you can of-course help it along by
looping the sections and saveAll on each one to get thee related data
saved.


On Apr 28, 4:33 am, rartavia <royarta...@gmail.com> wrote:
> I'm saving to one main table with several kind of relations by sending
> all in a single array via Ajax (jQuery). One is a nested relation,
> denouncements (main table) hasMany sections (other-model) which
> hasMany section_parts (another-model). Sending to saveAll in a single
> array i'm being able to save on to 'sections' table, how should
> section_parts should be placed and sent so cake can identify to which
> section they belong if I am saving for the first time (dont have
> section_id yet)
>
> I'm sending to cake, via jQuery.Ajax:
>
> data[Denouncement][title]=asdf&
> data[Denouncement][country]=Costa Rica&
> {...other attributes and models data...}&
> data[Section][0][user_given_name]=asdf&
> data[Section][0][type]=6&
> data[Section][0][SectionPart][0][name]=embed&
> data[Section][0][SectionPart][0][value]=<object...object>&
> data[Section][0][SectionPart][0][type]=embed&
> data[Section][0][SectionPart][1][name]=top_left_img&
> data[Section][0][SectionPart][1][value]=20090423T050438.jpg&
> data[Section][0][SectionPart][1][type]=img&
> data[Section][0][SectionPart][2][name]=bottom_left_img&
> data[Section][0][SectionPart][2][value]=20090423T050439.jpg&
> data[Section][0][SectionPart][2][type]=img&
> data[Section][1][user_given_name]=my section name&
> data[Section][1][type]=0&
> data[Section][1][SectionPart][0][name]=title&
> data[Section][1][SectionPart][0][value]=my value&
> data[Section][1][SectionPart][0][type]=text&
> data[Section][1][SectionPart][1][name]=text&
> data[Section][1][SectionPart][1][value]=another value&
> data[Section][1][SectionPart][1][type]=text
>
> Again, Sections are saved correctly, however, SectionParts are
> ignored, no error nor warning appears
>
> Thanks a lot for any help
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to