I found code here that works great for this problem....

http://bakery.cakephp.org/articles/view/alternative-methods-for-working-with-hasandbelongstomany-associations

On Sep 17, 1:57 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> I have:
>
> Model User
> Model Profile
>
> Profile belongs to User
> User hasOne Profile
>
> In addition, I want to let users save a list of their favorite
> profiles other than their own, so I added a habtm relationship to User
> model, with a join table user_favorites holding user_id and profile_id
>
> It seems to work, but I need a way to add a favorite without needing
> to save the User model.  Right now I have a method where I call User->save() 
> and only pass it the User.id and either one profile id or an
>
> array of ID's.  It does an unnecessary save of the User model id
> field, is there any way to avoid this part and just add the profile
> ids to the user_profiles table, or would I have to just write my own
> sql and use execute function?


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to