after extensive research, saveAll only supports one level deep. I
agree that this would be agreat feature.

On Sep 2, 6:11 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> No it doesn't.
> It explains exactly the basic functionality I know works.
> What I was interested in finding out was if there was some special
> trick to get it to save models associated to the associated model.
>
> Or in example form as in the link you provided:
> Todo hasMany Tasks but Tasks also hasMany SomethingElse
>
> When savingAll I first expected all three models to be saved but they
> are not. So I thought that possibly I would have to put the
> SomethingElse-data somewhere special or that the function only (no
> criticism implied) saves a single level of association. I tried moving
> "SomethingElse" into Tasks but the results were the same.
>
> I just want to know if it should work or not, that's all.
>
> /Martin
>
> On Sep 1, 9:55 pm, the_woodsman <[EMAIL PROTECTED]> wrote:
>
> > Does this article (number one google hit) shed any light?
>
> >http://blog.matsimitsu.nl/code/166/saveall-with-cakephp-part2
>
> > On Sep 1, 4:04 pm, Preloader <[EMAIL PROTECTED]> wrote:
>
> > > I just overwrote the saveAll() function in the Location model and
> > > saved the deep-level-association manually in order to rollback the
> > > whole transaction when validation fails. So the code in the Cakebin is
> > > just some kind of a wrapper.
>
> > > Yeah, maybe the "recursion problem" is the reason why saveAll() only
> > > saves the first level associations. I think to get the deep-level-
> > > thing to work, the structure of the data array should also reflect the
> > > relation structure: nested arrays instead of all models on the same
> > > level. I don't know ;-)
>
> > > I'm looking forward to the saveAll() section at
> > > book.cakephp.org ... :-)
>
> > > Regards, Christoph
>
> > > On 1 Sep., 16:37, "[EMAIL PROTECTED]"
>
> > > <[EMAIL PROTECTED]> wrote:
> > > > Thanks Preloader.
> > > > I have done something similar so far but thought I'd check if saveAll
> > > > had some hidden functionality.
>
> > > > Funny thing is that for hasMany (at least) you don't need saveAll to
> > > > save associated data... save does the job just fine for me... So
> > > > saveAll would work if it did not cut away at the data-array before
> > > > saving associations.
>
> > > > if Page hasMany Paragraph and I save to Page with Paragraph-data in
> > > > the array it gets saved too, without saveAll.
> > > > But if I saveAll in Post then Page will only ever see data for the
> > > > Page model and not any of the other data so it has no way of finding
> > > > Paragraph-data and save it like it normally would.
>
> > > > I think your pastebin code would work even without creating the new
> > > > arrays. I think it is the fact that you are using the public save/
> > > > saveAll that makes a lot of difference. (model.php uses __save) Since
> > > > model.php does not do this I guess there could be some problems with
> > > > infinite recursions when saving data where the association is defined
> > > > both ways? (nothing I have seen here)
>
> > > > Thanks for replying.
> > > > /Martin
>
> > > > On Sep 1, 3:57 pm, Preloader <[EMAIL PROTECTED]> wrote:
>
> > > > > Hello Martin,
>
> > > > > no, it does not seem to work for deeper levels.
>
> > > > > I hacked the saveAll() method in the main model, maybe it helps you:
>
> > > > >http://bin.cakephp.org/view/1083645660
>
> > > > > Location hasOne Address
> > > > > Location hasOne Contact (contact person)
> > > > > Contact hasOne Address (alias: CAddress)
>
> > > > > Regards, Christoph
>
> > > > > On 1 Sep., 15:22, "[EMAIL PROTECTED]"
>
> > > > > <[EMAIL PROTECTED]> wrote:
> > > > > > Hi guys,
> > > > > > I was going to rewrite some older code to use saveAll() and found 
> > > > > > that
> > > > > > saveAll seems built for "only" a single level of association. Is 
> > > > > > that
> > > > > > right or is my data-array possibly in the wrong format?
>
> > > > > > For example:
> > > > > > Article hasMany Page, Page hasMany Paragraph
> > > > > > I am able to save Article and Page data but have not been able to 
> > > > > > save
> > > > > > Paragraph data at the same time using saveAll.
> > > > > > I just wanted to check that this is correct and that I have not 
> > > > > > simply
> > > > > > missed some trick needed to get it to work. Looking at model.php it
> > > > > > looks like it only saves direct associations for the current model 
> > > > > > and
> > > > > > no "recursive" models.
>
> > > > > > regards
> > > > > > Martin
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to