Arrays cakephp下拉框和数组

Arrays cakephp下拉框和数组,arrays,cakephp,find,Arrays,Cakephp,Find,大家好,我在视图上有一个下拉框。我有一个find语句,它返回一个模板列表,当我调试find时,它会打印出template.id和template.name的正确列表。但是,当我提交表单时,它会带上列表中的数字,例如,如果我在列表中选择第五个模板,它会保存模板\u id=5,而不是实际的模板id号 //Retrieve Account Id of current User $accountid=$this->Auth->user('account_id'); //con

大家好,我在视图上有一个下拉框。我有一个find语句,它返回一个模板列表,当我调试find时,它会打印出template.id和template.name的正确列表。但是,当我提交表单时,它会带上列表中的数字,例如,如果我在列表中选择第五个模板,它会保存模板\u id=5,而不是实际的模板id号

//Retrieve Account Id of current User       
$accountid=$this->Auth->user('account_id');

//conditions for template arrays
$conditions=
array('AND' => array(
    array('Template.account_id' => $accountid),
    array('Template.active' => 1)
));

//An array of all Templates belonging to the current User's Account
$templates=$this->Template->find('list', array(
    'conditions' => $conditions));
当我调试$templates时,我得到这个打印输出

array(
    (int) 1 => 'Consulting- Bus',
    (int) 2 => 'Consulting- Pers',
    (int) 7 => 'ClientEdge',
    (int) 8 => '11111',
    (int) 9 => 'testSUn',
    (int) 10 => 'Test Bruce Review',
    (int) 11 => 'Test Bruce 3 = Final'
当我选择例如“Test Bruce Review”并点击submit and debug时,它会打印出值“6”,当我想在调试时打印出值10时,下拉框中的第6项

下面是表单中与此下拉框相关的片段

<tr><td><?php echo "Template: "?></td>
<td><?php echo $this->Form->input('template_id', array('label'=>false,'type'=>'select','options'=>$templates));?></td></tr>

如何解决此问题?

我在合并阵列时遇到问题,导致template.id死亡