On 29 Wrz, 12:23, AD7six <[EMAIL PROTECTED]> wrote:
> ... which is by design, otherwise how could you (easily) delete an > association. There are a few posts/threads/bakery articles/etc. around > with "working with habtm" in the title, after a quick google I am sure > you will find the info you are seeking ;). I've searched, but without success :( But I worked out this code: $this->data = $this->User->read(null, $this->obAuth->getUserId()); $friends = array(); $i = 0; foreach ($this->data['Friend'] as $friend) { $friends[$i++] = $friend['id']; } $friends[$i] = $id; $this->data['Friend']['Friend'] = $friends; if ($this->User->save($this->data)) { $this->Session->setFlash('Added to Friends.'); } So that looks to work ok. To make both side relation just need to run this code for every friend from $friends array. Tricky, but works for me right now. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---