0
Company class
public $hasMany = array(
'Person' => array(
'className' => 'Lasso.Person',
'foreignKey' => 'company_id',
)
Person class
public $belongsTo = array(
'Company' => array(
'className' => 'Lasso.Company',
'foreignKey' => 'id',
'conditions' => '',
'fields' => 'company',
'order' => ''
)
);
如何讓我的People視圖中的我的company_id字段成爲公司的顯示名稱而不僅僅是company_id的值?Cakephp關係問題
我已經在我的公司模型中有。 –
我想通了!需要做到這一點在我看來: $ people = $ this-> Company-> Person-> find('list'); $ this-> set(compact('people')); –
@JustinYoung你做了什麼你的看法? – Jelmer