var $belongsTo = array(
        'Course' => array('className' => ..., 'foreignKey' => ..., etc...),
        'Student' => array('className' => ..., 'foreignKey' => ..., etc...),
        ... as many associations as you like ...
);

All this'll do is attach more related models in your query results.

debug($this->FinalGrade->find('first'));
array(
        ['FinalGrade'] => array(
                ...
        ),
        ['Course'] => array(
                ...
        ),
        ['Student'] => array(
                ...
        ),
        ...
)

Can you clarify the second part of your question?

On 12 Sep 2008, at 05:06, soldier.coder wrote:

>
> I am still quite confused about expressing a "belongs to" relationship
> to more than one table at a time.  Consider this:  I am writing an app
> that will keep track of grades for students in multiple courses.  So
> my final_grades table has a course id, a student id, and a final
> grade.  So my understanding is that my final_grades table "belongs to"
> my "students" table and also to my "courses" table.
>
> How does one write the model for such a case? Included in the question
> is how does one include more than one table, more than one foreign
> key, more than one condition, and possibly more than one field?
>
>
> >


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