我在MySQL数据库中有2个表,即时通讯使用教义1.2和symfony 1.4.4

已安装的基础和备用

Installedbase:
ib_id
app_id
location


Spare:
spare_id
app_id
amount

现在,我想加入表格以显示有多少备用应用程序。

例如
$q = self::createQuery("l")
->select('i.*, s.*')
->from('InstalledBase i, Spare s')
->execute();

return $q;

主义知道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
我无法弄清楚这一点,有人知道什么教义在抱怨吗?

最佳答案

->from('InstalledBase i, i.Spare s')

...查询中别名为“s”的“备用”未引用与其相关的父组件。

不要向此查询添加其他条件,以不从两个表中返回所有内容。

07-26 02:35