CActiveRecord return array with values as index

Hey all,

Just came accross this topic :

http://www.yiiframework.com/forum/index.php?/topic/5000-primary-key-as-index-when-using-findall/

As it’s quite old I was wondering if it has been implemented? (couldnt find it in the doc).

If not that would be a really good idea. It is a bit annoying to loop through arrays.

Any comments/suggestions on that?

Cheers,

Not implemented. You may observe this ticket.

thanks :)

I think several framework implemented that already, funny that no more people asked for it as I think its quite important! :)

This is not hard to do with a helper. A Helper static method that returning a new array with model primary key as the array index. Performance impact is minimum because model is pass around by reference and grouping similar functionality together in a class.

thanks for your reply jamesmoey,

I didnt really catch your message. If you are fetching data and browsing the array reindex it, the performance will be impacted specially with big array.

Could you be a bit more precise please?

Cheers