2013-10-24 25 views
0

我有2个由Pods CMS创建的自定义内容类型:战斗和事件。在战斗内容类型中有事件的关系字段。我将如何通过特定事件ID从数据库中选择所有战斗?我试着手动查询豆荚关系表,但那给了我不正确的结果。如何使用关系字段查询Pods CMS?

回答

3
$fights = pods('fights'); 

$params = array(
    'where' => 'event.id = 3' 
); 

$fights->find($params); 

// loop through a while($fights->fetch()) and use $fights->field() to get the values of each field 

应该这样做,但你会想看看您的特定内容类型情况下event.id的“查找”的文件可能不是你想要的(你可能想event.ID)的东西。

http://pods.io/docs/code/pods/

http://pods.io/docs/code/pods/find/

http://pods.io/docs/code/pods/field/

http://pods.io/docs/code/pods/display/

+0

谢谢,但我得到以下错误:'未知列“,其中clause'' –

+0

它的工作原理 'event.id'!我打电话给事件pod的名称,而不是我的战斗pod - dumb哈哈事件字段的名称。非常感谢! –