I think case matters and you have a typo when setting the asociation (you
wrote $hasone and it's $hasOne ).
Also try setting the recursion level to something > 0 before calling find:

$this->Job->Manager->recursive = 1;
 $l = $this->Job->Manager->find('all', array('fields' =>
array('Manager.id <http://manager.id/>', 'Manager.user_id', 'User.first_name
',
'User.surname')));
     $result = Set::combine($l, "{n}.Manager.id",
"{n}.Manager.user_id");
     $this->set('managers', $result);

Good luck, I hope that works!


On Jan 31, 2008 10:14 PM, judouk <[EMAIL PROTECTED]> wrote:

>
>
> On 31 Jan, 23:49, "Matias Lespiau" <[EMAIL PROTECTED]> wrote:
> > I think your problem is that you're asking cake to just bring you the
> id's:
> >
>
> Thanks
>
> I've tried that
>
> I now have
>
>      $l = $this->Job->Manager->find('all', array('fields' =>
> array('Manager.id', 'Manager.user_id', 'User.first_name',
> 'User.surname')));
>      $result = Set::combine($l, "{n}.Manager.id",
> "{n}.Manager.user_id");
>      $this->set('managers', $result);
>
>
> but now I get the error;
>
> Query: SELECT `Manager`.`id`, `Manager`.`user_id`,
> `User`.`first_name`, `User`.`surname` FROM `managers` AS `Manager`
> WHERE 1 = 1
> Warning (512): SQL Error: 1109: Unknown table 'User' in field list
> [CORE/cake/libs/model/datasources/dbo_source.php, line 440]
>
> I suspect this is because the two tables aren't linked in that way.
> Not sure....its getting late at night so may not be thinking about
> this the right way either! (which probably isnt helping)
>
> J
> >
>


-- 
Matias Lespiau
http://www.gignus.com/

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to