コントローラーに次のコードがあります
$technicians = $this->Customer->Technician->find('list');
$account_managers = $this->Customer->Account_Manager->find('list');
$this->set(compact('technicians','account_managers'));
User モデルに次のコードがあります
public $hasMany = array(
'TicketComment' => array(
'className' => 'TicketComment',
'foreignKey' => 'user_id',
'dependent' => false,
'conditions' => '',
'fields' => '',
'order' => '',
'limit' => '',
'offset' => '',
'exclusive' => '',
'finderQuery' => '',
'counterQuery' => ''
),
'CustomerTech' => array(
'className' => 'Customer',
'foreignKey' => 'technician'
),
'CustomerManager' => array(
'className' => 'Customer',
'foreignKey' => 'account_manager'
)
);
顧客モデルに次のコードがあります
public $belongsTo = array(
'Technician' => array(
'className' => 'User',
'foreignKey' => 'technician',
'conditions' => '',
'fields' => '',
'order' => ''
),
'Account_Manager' => array(
'className' => 'User',
'foreignKey' => 'account_manager',
'conditions' => '',
'fields' => '',
'order' => ''
)
);
そして、私は私の見解に次のコードを持っています
<div class="control-group">
<?php echo $this->Form->label('technician', 'Technician', array('class' => 'control-label'));?>
<div class="controls">
<?php echo $this->Form->input('technician', array('class' => 'span12')); ?>
</div><!-- .controls -->
</div><!-- .control-group -->
<div class="control-group">
<?php echo $this->Form->label('account_manager', 'Account Manager', array('class' => 'control-label'));?>
<div class="controls">
<?php echo $this->Form->input('account_manager', array('class' => 'span12')); ?>
</div><!-- .controls -->
</div><!-- .control-group -->
「Technician」は適切な automagic 選択ボックスとしてビューに表示されますが、「Account_Manager」は単純なテキスト入力ボックスとして表示されます。私の知る限り、2つは同じように設定されています。では、なぜ 2 番目の入力が選択ボックスを形成しないのでしょうか?