Hi,

I've got a data schema where a parent table has multiple child tables,
and I'd like the child tables to know about each other, but they can
only be related via multiple columns.

Specifically, the parent table (Programs) hasOne child tables called
ProgramResults and ProgramResultsRanks. Each of these tables is
related back to the parent via a program_id column.

HOWEVER -- the parent has multiple results "periods". So it has a 12-
month ProgramResults, a 36-month ProgramResults, etc

I have a pretty complex controller that allows users to search and
sort the Results, and to lessen the load on the database (because of
all my associations, the page would take minutes to load if I did
everything through the parent Program table) I simply use the
ProgramResults's find() methods. The user is limited to viewing only
one results "period" at a time, however: only 12 month results, only
36 month results, etc.

Now, what I want to do is set up a hasOne association between
ProgramResults and ProgramResultsRanks, so that the ranks are loaded
for me automatically. Each ProgramResults will have one corresponding
ProgramResultsRanks with the same program_id and period. I tried
setting up the association like this:

var $hasOne = array(
                                'ProgramResultsRanks' => array(
                                        'className' => 'ProgramResultsRanks',
                                        'foreignKey' => 
array('program_id','period')
                                )
                        );

that is, make foreignKey an array. But that doesn't work. Is there a
different way I should be doing this, or do I need to hack Model
myself (or override the appropriate methods in my ProgramResults
model) to make this possible?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
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