我在CakePHP的新手和我有一個問題:虛擬域和模型別名
型號:CostsCenter-> Scholarship-> ScholarshipsDetail
1.獎學金型號虛擬現場:
public $virtualFields = array(
'code' => "UPPER(CONCAT(SUBSTR(CostsCenter.name, 1, 3), '-',
Scholarship.selection_year, '-', SUBSTR(Country.name, 1, 3), '-',
Postulant.number))");
2.列出所有從ScholarshipsDetail
控制器0$scholarships_detail = $this->ScholarshipsDetail->find('all',
array('contain' => array('Scholarship' => array('CostsCenter')),
'conditions' => array('ScholarshipsDetail.scholarship_id' => $scholarship_id)));
然後,我需要列出ScholarshipsDetail,但我有錯誤:
Column not found: 1054 Unknown column 'CostsCenter.name' in 'field list'
我試圖申請「包含」在CostsCenter跨越獎學金,但依然出現