Thanks John!
While your example didn't exactly work it did help me figure out what
to do.
function addfriend($id = null) {
if (!empty($this->data)) {
// set user id
$this->data['user_id'] = $this->Auth->user('id');
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
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 wrote:
> John,
>
> Wouldn't that save my data to my users table and not my users_users
> table? The
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 s
Your data structure for saving should look like this:
array
(
[User] => array
(
[id] => 999
)
[Friend] => array
(
[id] => 888
)
)
so do this:
[code]
if (!empty($this->data)) {
$this->data['User']['id'] = $this->Auth->user('id');
if ( $this->User->save( $this->d
Bump- Can anyone provide some insight on this?
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 cake-ph
I am trying to build a simple social network type site where a user
can friend another user. I realize this has been discussed before, a
lot, but none of the discussions on here really point out my issue so
I thought someone might be able to shine some light on where I am
going astray.
My user mo