I've searched through the groups and web, but I can't find any mention
of SAVING to the model, only reading from it.

Some example Models:

Recipes HABTM Tags
The "recipies_tags" table has an extra column which is "tagger_id"

I have tried setting the value in $this->data before the save but this
doesn't propagate back to the DB - the HABTM saves with the third
column empty
(I tried:
 $this->data['RecipiesTag']['tagger_id']
 $this->data['Tag']['RecipiesTag']['tagger_id']
 $this->data['Recipie']['RecipiesTag']['tagger_id']
 - are there any more locations I should try?)

I did find a way of saving to the third column, but it seems pretty
hacky:

$recipiestag = $this->Tag->RecipiesTag->find('first', array
('conditions' => array(
                                                                                
                                                                                
                                        'RecipiesTag.tag_id' => 
$this->data['Tag']
['tag_id'],
                                                                                
                                                                                
                                        'RecipiesTag.user_id' => 
$this->data['User']
['id']
                                                                                
                                                                                
                                )
                                                                                
                                                                        )
                                                                                
                                        );

$this->Tag->RecipiesTag->id = $recipiestag ['RecipiesTag']['id'];
$this->Tag->RecipiesTag->saveField('tagger_id', $user_id);

Is there a better way of doing this?

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to