進出口試圖複製在CakePHP中以下查詢:使用find方法符合下列條件的上傳模式將表添加到自定義查詢CakePHP中
SELECT *
FROM uploads, proposals
WHERE proposals.id = uploads.proposal_id AND proposals.tender_id = 10
林:
$conditions = array(
'Proposal.id' => $id,
'AND' => array(
'Upload.proposal_id' => 'Proposal.id'
)
);
return($this->find('list', array('conditions' => $conditions)));
,但即時通訊取而代之的是這個查詢
SELECT `Upload`.`id`, `Upload`.`title`
FROM `kumalabs_lic`.`uploads` AS `Upload`
WHERE `Proposal`.`id` = 10 AND `Upload`.`proposal_id` = 'Proposal.id'
正如你所看到的那樣,提議表丟失了,可以索姆ebody解釋我如何使這個查詢?
謝謝:)
你如何定義你的上傳模式?它對提案模型有關係聲明? – Habibillah
上傳屬於Proposal,這裏是代碼:http://pastie.org/5079273 – kumiau
看完你的代碼後,我創建了一個答案來解決你的問題 – Habibillah