Try:
$tags = $this->Output->Tag->find
(
"list",
array
(
"order"=>array("TagType.name", "Tag.name ASC")
)
);
The list method is now clever enough to insert a fields option that
includes your display key and primary key (usually something like name
and id respectively). If you want to generate a list that does not
include your models normal display key or primary key then there are
two ways to go; either:
1. As in the threan pointed to by manish, retrieve all data with a
find then do Set::combine; or
2. Just before you call your list method, set your models displayName
and/or primaryKey properties to whatever you want to have returned.
ianh
On Jan 22, 12:55 pm, manish <[EMAIL PROTECTED]> wrote:
> http://groups.google.com/group/cake-php/browse_thread/thread/996efa1f...
>
> On Jan 22, 4:20 pm, RichardAtHome <[EMAIL PROTECTED]> wrote:
>
> > Hi All
>
> > I've just upgraded a project to the latest beta 1.2 (cake_1.2.0.6311-
> > beta) and am struggling to get my head around the new find("list")
> > syntax.
>
> > Previously, I had:
>
> > $tags = $this->Output->Tag->generateList(null, array("TagType.name",
> > "Tag.name ASC"), null, null, null, "{n}.TagType.name");
>
> > Which returned me values suitable for a mutliselect box split into
> > catagories (TagType.name)
>
> > I've updated this to use find("list"):
>
> > $tags = $this->Output->Tag->find("list",
> > array("order"=>array("TagType.name", "Tag.name ASC"), null, null,
> > null, "{n}.TagType.name"));
>
> > But this generates the following error:
> > SQL Error: 1109: Unknown table 'TagType' in order clause
>
> > The SQL being generated is:
>
> > Query: SELECT `Tag`.`id`, `Tag`.`name` FROM `tags` AS `Tag` WHERE 1 =
> > 1 ORDER BY `TagType`.`name` ASC, `Tag`.`name` ASC
>
> > My question is: How to I get find("list") to return the data in the
> > same structure as my previous generateList() ?
>
> > Thanks in advance! :-)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---