Thursday, October 29, 2009

find list - group results using assoc field

Hi!

I have this assoc:
Group belongsTo Country

Im trying to get this array(to generate a select with form helper):

Array(
[Country.name] => Array
(
[Group.id] => [Group.name]
...
)
...
)

Example:
Array (
[Spain] => Array
(
[1] => Spain Admins
)
[Germany] => Array
(
[2] => Germany Support
[3] => Germany Admins
)
[Netherland] => Array
(
[4] => Netherland Translator
)
)

But doing this I get an error [Unknown column 'Country.name']:
$groups = $this->Group->find('list', array('fields' => array('id',
'name', 'Country.name')));

Any suggestion?

Thanks, and excuse my bad english!

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: