$teams = $this->Team->find('all', array('fields' =>
array('Team.id','Team.firstName','Team.lastName')));
$team_list = Set::combine($teams, '{n}.Team.id', array('%s %s',
'{n}.Team.firstName', '{n}.Team.lastName'));On May 8, 3:48 pm, jwerd <[EMAIL PROTECTED]> wrote: > I always follow the CakePHP standards and the way to utilize the > automagic part of CakePHP but sometimes I run into a problem where I > have an existing database and it's just not possible to change the > structure and thus I have to find a way around it, somehow. > > Picture this: > > 3 Tables > > projects > id > name > bla > bla1 > bla2 > > projects_teams > project_id > team_id > > teams > id > firstName > lastName > title > > everything's ok until we get to the teams part, where cake likes to > automagically use the title column from the table. I however need it > to display firstName and lastName within the projects view. > > http://www.nabble.com/How-to-make-findAll()-retrieve-just-some-fields... > > I found this article here, which explains I have to use find('all") > instead of automagic find('list), and everything is fine with how > that's done, however, when i get to the point of gluing firstName and > lastName together I'm stuck for the value of the select I'm stuck. > Can someone help me? > > $teams = $this->Team->find("all",array('fields' => > array('Team.id','Team.firstName', 'Team.lastName'))); > > $result = Set::combine($subdivisions, > '{n}.Team.id','{n}.Team.firstName'); > > Please help. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" 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?hl=en -~----------~----~----~----~------~----~------~--~---
