I am sure this was mentioned somewhere before, adding the field to the result in afterFind() is one way.

Additionally, if you specify $displayField, you don't need to have that last two arguments.
So, with the $displayField,
$this->set('user', $this->Transaction->User->generateList(null, 'last_name ASC, first_name ASC'));

Otherwise,
$this->set('user', $this->Transaction->User->generateList(null, 'last_name ASC, first_name ASC', null, '{n}.User.id', '{n}.User.full_name'));

And here is the User with afterFind:

class User extends AppModel
{
    var $name = 'User';
    var $displayField = 'full_name';

    function afterFind($results)
    {
        foreach ($results as $key => $val)
        {
            $results[$key]['User']['full_name'] =
            $val['User']['last_name'] . ', ' . $val['User']['first_name'];
        }
        return $results;
    }    
}

Hope this helps.

Sohei

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/cake-php
-~----------~----~----~----~------~----~------~--~---

Reply via email to