Using multiple valueFields in find('list')

后端 未结 3 579
无人共我
无人共我 2021-01-29 01:24

Trying to use multiple fields in my find method -

$users = $this->AdressesUsers->users->find(\'list\', [
            \'keyField\' => \'id\',
                 


        
3条回答
  •  花落未央
    2021-01-29 02:22

    I would never mess with the entity, keep it without logic and as simple as possible.

    A better approach here is to use what you already tried:

    'valueField' => function ($e) {
        return $e->first_name . ' ' . $e->last_name . ' ' . $e->more;
    }
    

    etc Just debug() the entity here and you will see that it contains the whole data set and you can put it together however you like.

提交回复
热议问题