Active Record Collection

Hello YII Guru’s.

The question is about Active Record Collection. Any reason why collection for Active Records still not implemented and finder’s return array instead of collection?

I’m create experimental implementation of Active Record Collection and try to found why I should not do it.

My implementation is:

class ArCollection extends CMap


  // Any collection related methods will be here


class BActiveRecord extends CActiveRecord


  // Overload CActiveRecord::populateRecords()

  public function populateRecords($data,$callAfterFind=true,$index=null)


    return new ArCollection(parent::populateRecords($data,$callAfterFind=true,$index=null));



From now any model must be created from BActiveRecord, for example:

class Post extends BActiveRecord



After any find, for example, Post::model()->findAll(), will be returned object ArCollection instead of array. ArCollection support "like array" operations but in additional I can create collection related methods.

Also I can override populateRecords in Post class, extends PostCollection from ArCollection and implement Post model specific collection methods.

Please any suggestions about this approach.

Thank you for your comments in advance.