【发布时间】:2012-08-16 16:34:17
【问题描述】:
我有三个模型:Company、Office、CompanyPersonTask。 Company 模型有很多 Office 和很多 CompanyPersonTask。
那么,为什么是这个代码:
public function getCompaniesByRegion($region){
$options['conditions'] = array("UPPER(Office.region) LIKE UPPER('".$region."%')");
return $this->find('all', $options);
}
导致以下错误?
“‘where 子句’中的未知列‘Office.region’”
region 列出现在offices 表中。
【问题讨论】:
-
会不会像您在上一句中写的那样,该表实际上称为
offices? -
你需要加入office吗?
-
该表称为offices,以复数形式,与任何其他db 表一样... 与名称约定相同。
标签: mysql cakephp cakephp-2.1