you could do it both ways technically, but IMO i would go with the
HABTM way and then create a model on the join table and use the 'with'
option in HABTM associations. Example:
class Group extends AppModel {
var $hasAndBelongsToMany = array('User' => array('with' =>
'GroupsUser'));
}
class GroupsUser extends AppModel {
var $belongsTo = array(
'Group' => array('className' => 'Group',
'foreignKey' => 'group_id',
'conditions' => '',
'fields' => '',
'order' => ''
),
'User' => array('className' => 'User',
'foreignKey' => 'user_id',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
}
On Jan 19, 3:34 pm, dan <[EMAIL PROTECTED]> wrote:
> I thought of a different way I could do ratings, I'm pretty new to
> CakePHP and I'm not sure if it would be better.
>
> I have users and games. I was going to have a ratings table, users
> hasmany ratings and games hasmany ratings. In the ratings table I
> would store what they rated the game. I want to be able to do things
> like users who liked this game also liked.
>
> I was reading about the new 1.2 habtm features and I thought of a
> different way. I could have a games_user table which would have a
> rating field. So the games_user table would have user_id, game_id,
> rating.
>
> Is one of the ways better than the other?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" 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
-~----------~----~----~----~------~----~------~--~---