Hi I want to be able to generate a list using find so that I can use in select helper. but there is a problem. i want too fetch id,name(first + last). so how can I achieve it. I want first_name and last_name to be joined as name . How can I achieve it.
$this->User->find('all',array('fields' => array('first_name','last_name','id')));
I can’t use model filters and callback Please suggest me how can I do it in controllers itself.
I think this can be done using the
virtualFieldsanddisplayFieldproperties in your model.In your model, define a virtual field for the full name like this:
If you now set displayField to full_name you should be able to get a list of your users with the
$this->User->find('list')method which you can use without problems with the Form-helper.… or:
The id is fetched automatically.