igg*_*ion 7 mysql doctrine symfony1 join dql
我在MySQL DB中有2个表,即使用doctrine 1.2和symfony 1.4.4
Installedbase和Spare
Installedbase:
ib_id
app_id
location
Run Code Online (Sandbox Code Playgroud)
和
Spare:
spare_id
app_id
amount
Run Code Online (Sandbox Code Playgroud)
现在我想加入表格,以显示有多少应用程序在备用.
例如
$q = self::createQuery("l")
->select('i.*, s.*')
->from('InstalledBase i, Spare s')
->execute();
return $q;
Run Code Online (Sandbox Code Playgroud)
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.
Run Code Online (Sandbox Code Playgroud)
yaml:http: //pastey.net/137237 我想不出这个,有人知道什么是教条抱怨吗?
->from('InstalledBase i, i.Spare s')
Run Code Online (Sandbox Code Playgroud)
...查询中别名为“s”的“Spare”不会引用与其相关的父组件。
请向此查询添加一些进一步的条件,以免返回两个表中的所有内容。
| 归档时间: |
|
| 查看次数: |
3554 次 |
| 最近记录: |