Ok, just checked with the CakePHP book again, and it is a little more
complicated than just saving the data.
http://book.cakephp.org/view/75/Saving-Your-Data#Saving-Related-Model-Data-HABTM-85
In the add a friend case, you are right! You have to save the
information in the HABTM table yourself, so as to avoid that CakePHP
automatically removes the friendships that are not specified in the
data.
So you data structure should be:
array
(
[FriendUser] => array
(
[user_id] => 999
[friend_id] => 888
)
)
and you use $this->FriendUser->save($this->data) to save it.
Sorry for the previous confusing posts!
Enjoy,
John
On Feb 5, 11:15 pm, John Andersen <[email protected]> wrote:
> No, CakePHP uses your HABTM definition between User and Friend (User),
> so that it knows, that your User.id and your Friend.id must go into
> the users_users table.
> John
>
> On Feb 5, 10:23 pm, Foroct <[email protected]> wrote:
>
> > John,
>
> > Wouldn't that save my data to my users table and not my users_users
> > table? The users_users table is where the friendships are kept.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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