Friday, September 4, 2009

Re: Complex model associations, pagination and containable

On Fri, Sep 4, 2009 at 2:16 PM, Miles J<mileswjohnson@gmail.com> wrote:
>
> But its in the where clause, so hes supplying it himself.
>
> LEFT JOIN `courses` AS `Course` ON
> (`CourseResult`.`course_id` = `Course`.`id`) WHERE
> `Course`.`course_type_id` = 1 AND `School`.`city` = 'London' AND
> `School`.`country_id` = '225' AND ((`CourseLevelMin`.`order` <= '1')
> OR (`Course`.`course_level_min` IS NULL)) AND `Course`.`published` = 1
> AND `Course`.`deleted` = 0 LIMIT 20

There's no join on schools in that query. The DB doesn't know what
"School" is because it hasn't been aliased to schools table ...
because there is no join on schools table. The DB doesn't care about
"city" because "School" is unknown but it specifies "School.city" in
the error msg because that's what's in the query. It *looks* like the
problem is *only* that the "city" column is unknown but, in fact, it's
"School.city" that the DB doesn't understand.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: