So I am no DBA, and this is my first CakePHP app, still learning the
ins and outs, maybe there is an easy way to do this..
Here is the setup:

Assume these psudo-tables:

Users
---------
id - pk
username
password
email
name

Items
---------
id - pk
user_id - fk
title
description
status

And the idea of the site is that people put items up, and can trade
them, so i'd like a trades table to keep track of live trades in
progress. So essentially I need:

Trades
----------
id - pk
item1
item2
user1
user2
status

HOWEVER, I'd like to use foreign keys instead of the item1 and 2 to
more easily work with the data and to allow it to bake correctly.  The
catch here though is that this would work perfectly with 1 item since
I could just associate using item_id, though I can't have TWO item_id
fields so how will I reference to unique items in the same table?
Also, correct me if I'm wrong but I probably don't even need user1 and
2 since they're associated in the Items table already.

Is there any easy way to do this in CakePHP so that bake should work?
I read but did not completely comprehend the $hasMany var in the Model
chapter of the manual, might this be the key to figuring this out?

Any help would be appreciated. I bring this up not only for this
project, but to learn how to do things RIGHT with CakePHP, for future
projects as well.

Thanks.


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

Reply via email to