Issue
$swimmer = $this->Swimmer->find('list', array(
'conditions' => array('Swimmer.group' => $this->data['Swimmer']['group_id']),
'order' => array('Swimmer.first_name ASC'),
'fields' => 'Swimmer.first_name'
));
Solution
First of all, setup a virtual field in your Swimmer model as suggested by Ann Pham. eg:
var $virtualFields = array(
'name' => "CONCAT(Swimmer.first_name, ' ', Swimmer.last_name)"
);
Then, fetch the data for your dropdown list like so: (assuming Swimmers controller)
$this->Swimmer->find('list', array('fields' => array('Swimmer.id', 'Swimmer.name')));
You could also try doing this in your SwimmerModel: var $displayName = 'Swimmer.name';
(not 100% sure if this would work). If it does work, you won't need the 'fields' array in the find.
Answered By - Dunhamzzz
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.