Sunday, March 1, 2009

2 foreign keys to same model?

Hi,
using cake1.2,

I came across a problem while setting up my database.
I have a question on how to set this database up by cake's convention.
I have the following 2 tables:

users
assets

each user has many assets, but any users can allow other users to
access their assets
so I figure the following, a third table is needed:

a table that has attributes:
owner, allowed

they both point to users_id, how do I make this table model in
cakephp? Is there another way to do this?
Because i know users_id means foreign key to table users, but how do
you have 2 foreign to the same table?

in short
users has many assets, any users can access other user's assets as
long as their id are on the allowed attribute of the owner id. both
columns points to the users table

thank you

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: