我在一个MySQL DB中有两个表,我使用的是doctrine 1.2和symfony 1.4.4
安装库和备用库
Installedbase:
ib_id
app_id
location和
Spare:
spare_id
app_id
amount现在我想加入to表,以显示有多少个应用程序在空闲状态。
例如:
$q = self::createQuery("l")
->select('i.*, s.*')
->from('InstalledBase i, Spare s')
->execute();
return $q;Doctrine知道app_id字段上的表之间存在关系,但我得到了错误的结果
500 | Internal Server Error | Doctrine_Hydrator_Exception
"Spare" with an alias of "s" in your query does not reference the parent component it is related to.yaml:http://pastey.net/137237我搞不懂这个问题,有谁知道教条在抱怨什么吗?
发布于 2010-06-04 17:02:10
->from('InstalledBase i, i.Spare s')..。查询中别名为"s“的"Spare”没有引用与其相关的父元件。
一定要在此查询中添加一些进一步的条件,使其不返回两个表中的所有内容。
发布于 2010-06-04 15:56:58
从表面上看,您还没有告诉Doctrine这两个表是相关的。
https://stackoverflow.com/questions/2972330
复制相似问题