我有这样的查询:
$customerList = $this->Project->Contact->find('list', array(
'fields' => array('Contact.id', 'Contact.displayName', 'Contact.companyName'),
'conditions' => array(
'Contact.group_id' => $this->Session->read('Auth.User.group_id'),
'Contact.company_id !=' => 0,
'Contact.deleted NOT' => 1
),
'order' => 'Contact.companyName ASC'
));
如果我调试它,它将显示类似的东西
array(
'Bosiang Ramli' => array(
(int) 90 => 'Bosiang Ramli'
),
'Harts Ramli' => array(
(int) 61 => 'Harts Ramli',
(int) 67 => 'Kayoko Bishop',
(int) 77 => 'Sintia Mary'
),
'Microsoft' => array(
(int) 83 => 'Internet Explorer',
(int) 84 => 'Windows Eight',
(int) 85 => 'X Box',
(int) 86 => 'Windows Phone'
),
'NySoft' => array(
(int) 82 => 'Norman Leonardi'
),
'Q Continuum' => array(
(int) 81 => 'Andrew Stewart',
(int) 87 => 'Jack Esters',
(int) 88 => 'Ron Swanson',
(int) 89 => 'Susan Mitchels'
)
)
当我把它放入表格时怎么样
echo $this->Form->input('contact_id',
array('label' => 'Customer', 'options' => $customerList)
);
它会删除Bosiang Ramli和Harts Ramli的选项吗? 我会展示一下图片。
这里有什么问题?以及如何解决它?
答案 0 :(得分:0)
我只需要添加
'showParents' => true
作为一个参数