【发布时间】:2012-04-20 09:38:13
【问题描述】:
我的模型中有以下关系
基本索引属于申请人
申请人有很多请求
因此,我想检索 BasicIndexing 模型并包含申请人模型和申请人对应的请求,如下面的代码所示
$fullCondition = array(
'contain' => array(
'Applicant' => array(
'Request',
'fields'=>array('Applicant.surname','Applicant.first_name','Applicant.id')
)
),
'conditions' => $conditions,
'fields'=>array('BasicIndexing.application_date','BasicIndexing.application_number')
);
$this->loadModel('BasicIndexing');
$searchResult = $this->BasicIndexing->find('all',$fullCondition);
问题是返回到$searchResult 的结果根本不包含Request 模型。它只包含申请者模型并忽略请求模型。我尝试使用与申请者无关的模型,但收到警告说该模型与申请者模型无关。
Array
(
[0] => Array
(
[BasicIndexing] => Array
(
[application_date] => 2012-04-17
[application_number] => BIA170420124356
)
[Applicant] => Array
(
[surname] => Kermit
[first_name] => Frog
[id] => 4f8d3b63-c2bc-48a1-9fb5-0290c982293d
)
)
)
是我做错了什么还是蛋糕 1.3.0 版本有问题?
任何帮助将不胜感激。
谢谢。
【问题讨论】:
标签: cakephp cakephp-1.3 containable