我在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跨越奖学金,但依然出现