【发布时间】:2011-12-21 08:43:15
【问题描述】:
我有这张 NPO 表,它有一个模板。模板又具有主题。我想检索Npo选择的主题。
我有以下关系设置:
NPO - npo.id 上的模板 = template.npoid 模板 - theme.id 上的主题 = template.template_theme_id
我正在使用:
$this->Npo->bindmodel(array(
'hasOne' => array(
'NpoTemplate' => array(
'className' => 'NpoTemplate'
)
)
), false);
$this->NpoTemplate->bindmodel(array(
'hasOne' => array(
'TemplateTheme' => array(
'className' => 'TemplateTheme',
'fields' => 'TemplateTheme.html'
)
)
), false);
$arrUserSite = $this->Npo->find('first', array(
'conditions'=> array(
'Npo.address' => $user
)
));
但它不会从 TemplateTheme 获取任何内容。相反,它为此表编写一个单独的查询,并且在连接中不考虑它。
我已将recursive 级别设置为3
请帮忙。我真的不明白蛋糕协会是如何运作的。
问候 希曼舒·夏尔马
【问题讨论】:
-
belogsTo:你的意思是……belongsTo?