Yep for 1-1 relations that would work - I should've used a 1-n example.  :)

Imagine a social networking site with people, groups, & photos:
 - Person hasMany Photo
 - Group hasMany Photo
 - Photo belongsTo Person, Group

Then you'd need to do:

photos
 - id
 - person_id
 - group_id


On 5/4/07, John David Anderson (_psychic_) <[EMAIL PROTECTED]> wrote:
>
>
> On May 4, 2007, at 12:18 PM, [EMAIL PROTECTED] wrote:
>
> >
> > You're right - that should work.  You'd end up with two foreign keys
> > in the addresses table, only one of which would be valid in each row:
> >
> > addresses
> >  - id
> >  - person_id
> >  - company_id
>
> Or:
>
> people
> - address_id
>
> companies
> - address_id
>
> (FWIW)
>
> -- John
>
> >
>

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