Felix wrote a nice writeup of HABTM and extra data, which may be what
youre after- I didnt really understand your question entirely though!

be sure to read the comments.
http://www.thinkingphp.org/2006/10/26/modeling-relationships-in-cakephp-faking-rails-throughassociation/


Luke

On Aug 6, 7:46 am, Jim Newfer <[EMAIL PROTECTED]> wrote:
> rtconner,
>
> Thank you for the reply. Now I'm not sure you understand me correctly,
> or I am not sure I understand myself :P. I am aware of this method,
> filtering a HABTM relationship creating a "dummy" model in the join
> table. I already have something like this and it works perfectly.
>
> What I don't understand what you are saying is, what I tables should
> be made? Are you saying that all is necessary is the join table
> FansUsers and then in there do something like User.id, and Fan.id, and
> The FansUsers each FansUser belongs to one user? I don't understand
> how that would work because If I have user A, and he has fans B and C,
> then I want fans B and C to belongs to their corresponding
> information, so when I pull up the fans for user A, I get user B and
> user C's information.
> So if I understand you correctly, I will only need one extra table,
> and will just need to fabricate a join table everytime I wish to find
> the fans of a user?
>
> Thank you,
> Jim
>
> On Aug 1, 8:59 am, rtconner <[EMAIL PROTECTED]> wrote:
>
> > If I'm catching what you are doing... You have to create a FansUser
> > model and add some relationships to it.
>
> >http://groups.google.com/group/cake-php/browse_frm/thread/f23b1825050......
>
> > I think.. this is what you want. I could be wrong though.
>
> > On Aug 1, 9:47 am, Jim Newfer <[EMAIL PROTECTED]> wrote:
>
> > > Anyone? Sorry, I am just stuck. If there was some way in cake to
> > > specify an alternative key it is searching for in the foreign table, I
> > > think that may solve my problem.
> > > Thanks.
>
> > > Jim.
>
> > > On Jul 31, 1:55 pm, Jim Newfer <[EMAIL PROTECTED]> wrote:
>
> > > > Hello everyone,
>
> > > > Last resort post, I am stuck. What I have done is create a "friends"
> > > > system in my app. Although it is mildly tricky because the friends are
> > > > the same thing as users, just using an alias.
>
> > > > My tables look like this right now (only relevant information shown):
>
> > > > Users:
> > > > Id
>
> > > > Fans_Users:
> > > > fan_id
> > > > user_id
>
> > > > Fans:
> > > > id
> > > > fans_info
>
> > > > The fan is just an alias for another user. I have the HABTM
> > > > association set up fine and dandy. But what I cannot seem to get to
> > > > work no matter what I try, is get the user infomation to be be pulled
> > > > up with that fan. For example, User 67 has two fans, users 45 and
> > > > users 46. Not when I query for User 67, his two fans are shown, users
> > > > 45 and 46. BUT, I want users 45 and users 46 information to be shown
> > > > as well. I have tried all sorts of combinations of hasOne/belongsTo in
> > > > the fans table to get the fan to link to some user info. Even tried
> > > > adding a fan_id to the user table, (which is the same thing as their
> > > > id) And linking it to that. Problem is, it is matching the Fan.id to
> > > > the fan.user_id which is obviously a problem. I was thinking if I
> > > > could somehow modify the primary key it is searching for in the local
> > > > table, it could work (instead of matching the Fan.id to the User.id,
> > > > match the Fan.fan_id to the User.id)
>
> > > > I am really stuck here, has anyone attempting anything similar?
>
> > > > Thanks.
>
> > > > Jim


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