【发布时间】:2015-06-01 14:54:51
【问题描述】:
好的,所以我有两张桌子。一个叫Properties,另一个叫PrInfo。
Properties 是基表,PrInfo 是另一个包含额外信息的表。
我想将它们连接在一起,以便在网站上显示信息。
$query = Properties::query()
->leftJoin('PrInfo','pr.pr_id = Properties.id','pr')
->execute();
在我的脑海中,每个查询的索引都应该与 PrInfo 表中的一行连接,因为声明了“pr.pr_id = Properties.id”
但是,当我键入“print_r($query[1]);”时,我可以在执行的查询中看到 确实包含了 pr_info 表,但是我不确定它是否与属性表中的行匹配。
我尝试过print_r($query[1]['PrInfo'],但是我得到了一个错误。
有什么想法吗?
在
中有以下内容 protected '_hasManyToManySingle' => null
protected '_initialized' =>
array (size=2)
...
protected '_sources' => null
protected '_schemas' => null
protected '_behaviors' => null
protected '_lastInitialized' =>
object(PrInfo)[51]
...
protected '_lastQuery' => null
protected '_reusable' => null
protected '_keepSnapshots' => null
protected '_dynamicUpdate' => null
protected '_namespaceAliases' => null
protected '_modelsMetaData' => null
protected '_errorMessages' => null
【问题讨论】:
-
为什么不直接做一个
var_dump($query);看看里面有什么? -
底部有以下内容:
-
检查更新版本^^^
-
@Crembo 我真的不知道对象是什么意思(PrInfo)[51]