You can do it with Set::combine, I haven't tried it, but should work 
along the lines of:
$data = Set::extract($data,'/ModelName/id','/ModelName/');

Sikul wrote:
> Is it possible to change the index of $results object returned by the
> find() method from index of 1,2,3,...,n to a values of a field?
>
> For instance, I have a table like so:
> id | filter | total | max
>
> I'm doing select where filter = <filter> and it's returning as:
>
>  [0] => Array
>         (
>             [table_name] => Array
>                 (
>                     [id] => 173
>                     [filter] => All
>                     [total] => 26347
>                     [max] => 1613
>                 )
>
>         )
>
> I'd like it to return as:
>
> [173] => Array
>         (
>             [table_name] => Array
>                 (
>                     [id] => 173
>                     [filter] => All
>                     [total] => 26347
>                     [max] => 1613
>                 )
>
>         )
>
> Where 173 is the id.  Is this possible?  If not I guess I could change
> my tables but I really don't want to do that.
>
> >
>
>   


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to