How do I create a keyValue pair (display field) by combining/having two fields in CakePHP 3?
- 阅读更多 关于 How do I create a keyValue pair (display field) by combining/having two fields in CakePHP 3?
问题 I need help getting two values (for human friendly dropdown) in a key-value pair using find or get or anything else. I need help with the simplest method of doing this in CakePHP. Here's my attempt: in my controller $users = $this->LocationsUser->Users->find('list', [ 'limit' => 1, 'keyField' => 'id', 'valueField' => ['first_name', 'last_name'] ])->where(['id' => $id]); In my view echo $this->Form->input('user_id', [ 'options' => $users, 'type' => 'select', 'multiple' => false, ]); The result