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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment