在cakephp3的查询列表中显示自定义字段
我想创建一个带有自定义字段的下拉列表,但我的列表查询将id字段附加到查询中。如何在我的查询中仅显示选定字段在cakephp3的查询列表中显示自定义字段,cakephp,cakephp-3.2,Cakephp,Cakephp 3.2,我想创建一个带有自定义字段的下拉列表,但我的列表查询将id字段附加到查询中。如何在我的查询中仅显示选定字段 $this->loadModel('CardTypes'); $cardTypes = $this->CardTypes->find('list')->select(['code', 'name']); 在我看来 $this->Form->select('card_type_id', $cardTypes, [ 'default' => 'DEL
$this->loadModel('CardTypes');
$cardTypes = $this->CardTypes->find('list')->select(['code', 'name']);
在我看来
$this->Form->select('card_type_id', $cardTypes, [ 'default' => 'DELTA']);
见
见
$this->CardTypes->find('list',['keyField'=>'code','valueField'=>'name'])
$this->CardTypes->find('list',['keyField'=>'code','valueField'=>'name'])
$cardTypes = $this->CardTypes->->find('list', [
'keyField' => 'code',
'valueField' => 'name'
]);