Afternoon all,

This may be a stupid question but I would like to know as it would
make life somewhat simpler at the end of the day.

In a hasOne relationship address:

e.g. User hasOne UserDetail

Where the users table includes core user information and the
user_details table includes additional information (just an example).

Normally I would put the user_id in to the user_details table yes? and
the hasOne association set in the User model would always return the
UserDetail data.

What if I wanted a single table to act as the one to many tables (if
that makes sense). For example:

donations
orders
payments

will be three different methods that a user can pay money on a
particular site I'm working on. Each of these will be using the same
payment gateway which has supplies certain information that I would
like to record. I like to record this in a seperate table in case I
need to switch gateways at any point.

So, I would usually have just the one table, like so:

orders -> recording amount paid, and other information
order_gateway_details -> recording particular gateway stuff for this order

[bad table names I know but it's late on a friday afternoon]

now i would be forced to create three seperate gateway_details tables.

order_gateway_details
donation_gateway_details
payment_gateway_details

is it acceptable to put the id of the gateway details in to the
orders, donations, and payments table? that way I could record all of
the details in the one table where they belong. yet still reference
them from their respective payment methods.

I would be reversing the relationship I realise - gateway_details
doesn't ever have one donation (etc). but it would make life easier...

this is not cool is it?

penny for your thoughts.

cheers,
mikee

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