0
不好意思,大家在cakephp有很高的技巧, 我開始在cakephp, 我不知道如何訪問字段,我想要使用的值。 cakephp訪問字段搜索模型中有關係模型
這是陣列數據從控制器
Array
(
`[Claim] => Array`
(
[id] => 121
[name] => Gwoo the Kungwoo
[created] => 2007-05-01 10:31:01
)
[ClaimDetail] => Array
(
[0] => Array
(
[id] => 123
[claim_id] => 121
[title] => On Gwoo the Kungwoo
[body] => The Kungwooness is not so Gwooish
[date] => 2006-05-01 10:31:01
)
[1] => Array
(
[id] => 124
[claim_id] => 121
[title] => More on Gwoo
[body] => But what of the 'Nut?'
[date] => 2006-05-01 10:41:01
)
)
);
在控制器我提出的條件 顯示,
$conditions = array(
'ClaimDetail.date between ? AND ?' => array(
$this->request->query['start_date'],
$this->request->query['end_date']
),
'Claim.delete_flag' => 0
);
但cakephp中顯示錯誤,未知字段,
這是發現,
$claim = $this->Claim->find('all', array(
'conditions' => $conditions
));
Error: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ClaimDetail.date' in 'where clause'
有任何是其他的方式,我做的條件像我想要什麼,
thankss before and after... T_T stuck one week
您已將此'ClaimDetail.date'更改爲'Claim.date' –