【发布时间】:2010-05-25 10:46:24
【问题描述】:
我在使用原则选择数据子集时遇到问题。
我有 3 张桌子
位置 接触 联系方式
联系人和位置表包含名称和 ID,而另一个表仅包含 ID。例如:
Location
loc_id: 1
name: detroit
Contact
contact_id: 1
name: Mike
Contact_location
loc_id: 1
contact_id: 1
在原则上,location 和contact 表之间存在多对多关系,contact_location 作为 ref_class。
我想做的是在我的位置页面上找到所有联系人,例如 loc_id = 1。
我试过了:
$this->installedbases = Doctrine::getTable('contact')->findByloc_id(1);
希望教义能看到并理解这种关系,但它没有。
如何在相关的相关表格中进行教义搜索?我读到它可以使用 Findby 完成,但我发现文档不清楚。
【问题讨论】:
标签: symfony1 doctrine orm foreign-key-relationship