Re: Saving additional fields in HABTM tables (With Associations)
Here is what I am trying so far. http://bin.cakephp.org/view/1751195932 But this example only shows how to save the foreign keys in the HABTM table. But I have not found out yet how to populate additional fields. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Re: Saving additional fields in HABTM tables (With Associations)
I'd create a class between others, like a join class. On 30 jan, 12:35, su6z3r0 [EMAIL PROTECTED] wrote: Here is what I am trying so far. http://bin.cakephp.org/view/1751195932 But this example only shows how to save the foreign keys in the HABTM table. But I have not found out yet how to populate additional fields. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Re: Saving additional fields in HABTM tables (With Associations)
Tulio, thank you for your reply. I guess your are proposing something which is explained here: http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faking-rails-throughassociation/ However, my understanding was that it should now (cake 1.2) with HABTM and with associations. I read the above article and the replies but still couldn't find out how to save additional data. But maybe I should go the way you described. It's a little bit frustrating as a beginner to spent hours on a tiny step :-) On Jan 30, 6:20 pm, Tulio Faria [EMAIL PROTECTED] wrote: For example, a model: GuessLocation that belongsTo: Guess and Location, and Guess and Location hasMany: GuessLocation. On 30 jan, 14:14, Tulio Faria [EMAIL PROTECTED] wrote: I'd create a class between others, like a join class. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Re: Saving additional fields in HABTM tables (With Associations)
When I had to implement this functionality I did what Tulio suggested. I believe that the with associations sole purpose is so that you don't have to do this though. I haven't tried playing around with it, but have you tried this yet: Before you save your post data try adding a taggedpost field to it with the desired data: $savepost=$this-data; $savepost['Post']['TaggedPost']=$sometaggedpostdata; $this-Post-save($savepost); On Jan 30, 10:20 am, Tulio Faria [EMAIL PROTECTED] wrote: For example, a model: GuessLocation that belongsTo: Guess and Location, and Guess and Location hasMany: GuessLocation. On 30 jan, 14:14, Tulio Faria [EMAIL PROTECTED] wrote: I'd create a class between others, like a join class. On 30 jan, 12:35, su6z3r0 [EMAIL PROTECTED] wrote: Here is what I am trying so far. http://bin.cakephp.org/view/1751195932 But this example only shows how to save the foreign keys in the HABTM table. But I have not found out yet how to populate additional fields. Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Re: Saving additional fields in HABTM tables (With Associations)
But maybe I should go the way you described. It's a little bit frustrating as a beginner to spent hours on a tiny step :-) Did you check this? Bug in cake beta 1.2 model : http://groups.google.com/group/cake-php/browse_thread/thread/2ad48c4e10f58fc0/c7c4511051071b52 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---
Saving additional fields in HABTM tables (With Associations)
Hello, I saw the example in the PDF (http://www.cakephp.org/files/OCPHP.pdf) but I don't get how the date field of the posts_tags table is populated. Also it is not quite clear to me what the beforeSave() method in this example does. Would you still use $this-data['Tag']['Tag'] = array($this-Tag-id); and then save the POST model? TIA, Alex --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP 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 -~--~~~~--~~--~--~---