Re: saveAll & Edit - Creates instead of Updating even with passed IDs
Thank you Fain and Jon!!! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
> Hey, thanks for helping with this. Here is my model: > http://bin.cakephp.org/view/1912370055 > > I thought it seemed backwards but users here said it made sense and > that's what bake gave me so I stopped questioning it. Basically, I > have listings, categories and promotions that all have titles and > bodies. Do you think that my models are the problem? I think you need the following: http://bin.cakephp.org/view/2134741687 hth jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
> that's what bake gave me so I stopped questioning it. Basically, I > have listings, categories and promotions that all have titles and > bodies. Do you think that my models are the problem? imho it would be cleaner put the field title and body in all the tables, if there are not title and bodies, shared between the tables.. -- pietro --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
Hey, thanks for helping with this. Here is my model: http://bin.cakephp.org/view/1912370055 I thought it seemed backwards but users here said it made sense and that's what bake gave me so I stopped questioning it. Basically, I have listings, categories and promotions that all have titles and bodies. Do you think that my models are the problem? --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
Hi, It's a little unclear to me how your associations are set up. Does a Promotion hasMany Title,Body or do Title and Body hasMany Promotion? My suggestions assume the former. > Here is the action: http://bin.cakephp.org/view/994290013 With saveAll, there's no need to manually enter the foreign key values, try: http://bin.cakephp.org/saved/46309 > Here is the view: http://bin.cakephp.org/view/1805109334 You're saving a promotion in your controller that hasMany Titles/Bodies, so you don't need foreign keys for body_id or title_id, the Body and Title tables would have a promotion_id column instead (they belong to the Promotion). http://bin.cakephp.org/saved/46311 If I'm wrong and it's Title or Body hasMany promotions, then you have to call saveAll on Title or Body instead (and adjust your views accordingly). hth Jon -- jon bennett w: http://www.jben.net/ iChat (AIM): jbendotnet Skype: jon-bennett --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
> Absolutely: > Here is the action: http://bin.cakephp.org/view/994290013 > Here is the view: http://bin.cakephp.org/view/1805109334 i think you should save the id in the $data array... like: $this->data['Title']['id'] = $current['Promotion']['title_id']; the same for body.. you saveAll($this->data), so you should modify this ;-) tell me if it works,,, -- pietro --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
Absolutely: Here is the action: http://bin.cakephp.org/view/994290013 Here is the view: http://bin.cakephp.org/view/1805109334 Thanks! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
can you put on bin ( http://bin.cakephp.org/ ) the code of the whole action? and myabe the view? -- pietro --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: saveAll & Edit - Creates instead of Updating even with passed IDs
I also tried this: $this->Promotion->title_id = $current['Promotion'] ['title_id']; But it did not work either... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---