25 debug()s later... saving HABTM works fine... On one project (being converted from 1.1 to 1.2) the problem was in beforeSave which removed the HABTM by using read() (which in 1.1 worked a bit differently). On the other The problem was a validation rule.
So, sorry for the useless question. Looking at the test-files, I found something I haven't seen before: instead of: $this->Model->create(); $this->Model->save($data); this was used with the same results: $this->Model->set($data); $this->Model->save(); Since save() also calls set() create might be unnecessary now? (unnecessary for "clearing" the model in a loop, that is) But where I am still doing that I should probably start using saveAll(). On Aug 28, 12:46 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hi, > I have noticed that saving HABTM records have stopped working for me. > (Saving an Article and which Categories it should be linked to for > example) > > Cake1.2rc2 (and the latest nightly) does no longer save my array > structure as before. I have not found anything in the API, Cookbook or > here to show me what might have changed or what I am doing wrong. I > found one thread where one guy had found his answer in the test-file > (supposedly the test-file for Model) but no more info was given. > > Before: > $data > Article > id > title > .... > Category > Category > 2 > 6 > > That is: $data['Category']['Category'] = $array_of_ids > > This does not work anymore. This is true for two separate codebases, > one where I have not touched the affected models in a while. This > makes me think it is not just a but I have managed to introduce but > something subtile that has changed that affects my accosiations. > The API suggests that saveAll() is now the method to use when saving > associated data. > testSaveHabtm() in model.test.php has the same structure as I have (as > far as I can tell): > Tag=>Tag=>array_of_ids > > Has something changed that now requires me to define the HABTM in more > detail than simply the name of the model? > > Any ideas? > > /Martin --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
