On Fri, Sep 4, 2009 at 4:12 AM, martinp<[email protected]> wrote:
>
> Haven't I got MySQL errors because my model's aren't being contained?

Yes.

I've run into problems like this before and found that I needed to be
explicit about the fields--specifically the foreign keys--for
Containable to be able to deal with the association. Something like:

$this->paginate['CourseResult'] = array(
        'fields' => array(
                'CourseResult.course_id',
                //etc.
        ),
        'contain' => array(
                'Course' => array(
                        'fields' => array(
                                'Course.school_id',
                                //etc.
                        ),
                        'CourseLanguage' => array(
                                'fields' => array(
                                        'CourseLanguage.course_id',
                                        //etc.
                                )
                        ),
                        'CourseType' => array(
                                'fields' => array(
                                        'CourseType.course_id',
                                        //etc.
                                )
                        ),
                        'CourseLevelMin' => array(
                                'fields' => array(
                                        'CourseLevelMin.course_id',
                                        //etc.
                                )
                        ),
                        'CourseLevelMax' => array(
                                'fields' => array(
                                        'CourseLevelMax.course_id',
                                        //etc.
                                )
                        ),
                        'School' => array(
                                'fields' => array(
                                        //etc.
                                )
                        ),
                        'CourseQualification => array(
                                'fields' => array(
                                        'CourseQualification.course_id',
                                        //etc.
                                )
                        )'
                )
        ),
        'conditions' => $conditions
);

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