On Jan 23, 5:20 pm, Robert <[email protected]> wrote:
> Hi there,
>
> I have really a great problem designing one part of my mysql db.
>
> I need a join table in my db with three foreign keys, or three habtm
> relations.
> I already have three tables for three entities, each with primary key.
> And it is definetly necessary for me to have a join table with all
> three primary keys as foreign keys.

A 'join table' with more than 2 fields in it, is a model. Treat it as
such and your complexity dissolves

>
> Entity1
> ----------
> PK1 , Entry
>
> Entity2
> ----------
> PK2, Entry
>
> Entity3
> ---------
> PK3 Entry
>
> Join Table
> ----------
> PK, FK1, FK2, FK3

Use real names please.

Entity1 hasMany <name of join model>
Entity2 hasMany <name of join model>
Entity3 hasMany <name of join model>

<name of join model> belongsTo Entity1, Entity2, Entity3
>
> How can I bake such a table? I found nothing about naming conventions
> about this issue. Should I call the table
> "entities1_entities2_entities3" ??? I really found no hint in all the
> documentation, bakery, etc...
> I would appreciate every help.

You'll find no docs on creating a join table for such a scenario,
because it's not really a join table and trying to treat it as such
creates complexity where none exists.

hth,

AD
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"CakePHP" 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