omg that was so freaking obvious! I'd been trying all sorts of things;
that never occurred to me.
Thanks a bunch!
On Fri, Apr 25, 2008 at 1:53 AM, squawk <[EMAIL PROTECTED]> wrote:
>
> Try this:
>
> find('list', array('order'=> 'field'));
>
>
>
> On Apr 24, 11:21 pm, "b logica" <[EMAIL PROTECTED]> wrote:
> > cake_1.2.x.x_24.01.2008
> >
> > I need to specify an order on a find('list') call and nothing I've
> > tried is working :-(
> >
> > Is the new find() format documented anywhere? I can't even remember
> > where I learned about it. Can 'list' be ordered?
> >
> > For the interested, here's the relevant hunk of model.php:
> >
> > case 'list' :
> > if (empty($query['fields'])) {
> > $query['fields'] =
> array("{$this->alias}.{$this->primaryKey}",
> > "{$this->alias}.{$this->displayField}");
> > $keyPath = "{n}.{$this->alias}.{$this->primaryKey}";
> > $valuePath = "{n}.{$this->alias}.{$this->displayField}";
> > $groupPath = null;
> > } else {
> > if (!is_array($query['fields'])) {
> > $query['fields'] =
> String::tokenize($query['fields']);
> > }
> > if (count($query['fields']) == 1) {
> > $keyPath =
> "{n}.{$this->alias}.{$this->primaryKey}";
> > $valuePath = '{n}.' . $query['fields'][0];
> > $groupPath = null;
> > $query['fields'] =
> array("{$this->alias}.{$this->primaryKey}",
> > $query['fields'][0]);
> > } elseif (count($query['fields']) == 3) {
> > $keyPath = '{n}.' . $query['fields'][0];
> > $valuePath = '{n}.' . $query['fields'][1];
> > $groupPath = '{n}.' . $query['fields'][2];
> > } else {
> > $keyPath = '{n}.' . $query['fields'][0];
> > $valuePath = '{n}.' . $query['fields'][1];
> > $groupPath = null;
> > }
> > }
> >
> > Believe me, I've tried! If it's impossible, I can always re-order the
> > array when I get it. Or I could create a view in Postgres to keep any
> > selects to this table ordered the way I want (it's a lookup table,
> > basically, but order is important). But I'm curious is this can be
> > done directly.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---