Fetching row from AR query

I’ve not look deep into the AR component but still wanna ask if anyone know how to fetch row from AR query in the same way of fetching from DataReader.

For example:

$articles = Article::model()->findAll(); //I have an array of Article object

If I need to perform some modification to each object then I have to make a loop and it slows down performance. I am thinking about

$resource = Article::model()->findAll(param1, param2,…,return_raw_resource)

while(($article = $resource->read()) != false){

//modify $article's attributes

//add to an array



I don’t think that can be done. CActiveRecord does have some methods for bulk updating though, and there’s also afterFind(). Maybe that’ll help?

Thank Sander.

For my sample code afterFind() helps partialy. In fact, as I will return the result articles to an ajax request, what I need is just the $article->attributes array. Digging Yii code ;)