I really don't know how to thank you
I will try it as soon as i get home
Thanx alot

John
On 3/18/10 10:22 AM, WebbedIT wrote:
Heres a quick stab at it

Tables:
musics
users
musics_ratings
musics_privacies

Music model HABTM
    'Rating' =>  array(
       'className' =>  'User',
       'joinTable' =>  'musics_ratings',
       'with' =>  'MusicsRating',
       'foreignKey' =>  'music_id',
       'associationForeignKey' =>  'user_id',
       'unique' =>  true
     ),
    'Privacy' =>  array(
       'className' =>  'User',
       'joinTable' =>  'musics_privacies',
       'with' =>  'MusicsPrivacy',
       'foreignKey' =>  'music_id',
       'associationForeignKey' =>  'user_id',
       'unique' =>  true
     )


User model HABTM
    'Rating' =>  array(
       'className' =>  'Music',
       'joinTable' =>  'musics_ratings',
       'with' =>  'MusicsRating',
       'foreignKey' =>  'user_id',
       'associationForeignKey' =>  'music_id',
       'unique' =>  true
     ),
    'Privacy' =>  array(
       'className' =>  'Music',
       'joinTable' =>  'musics_privacies',
       'with' =>  'MusicsPrivacy',
       'foreignKey' =>  'user_id',
       'associationForeignKey' =>  'music_id',
       'unique' =>  true
     )

MusicsRating model
class MusicsRating extends AppModel {

   var $belongsTo = array(
     'Music',
     'User'
   );

}

MusicsPrivacy should not need creating

You may want to then read the following for assistance on saving the
extra field
http://teknoid.wordpress.com/2008/09/24/saving-extra-fields-in-the-join-table-for-habtm-models/

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

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

Reply via email to