CActiveRecord->findBySql extension

Hi.

I`m quite a newbie in Yii. And, to be true, in ActiveRecord also.

So I want to ask a question there - probably I was just inattentive in docs. Here is the problem…

I have tables: user, user_details, city and country. I`ve done ActiveRecords and relation rules for all of them.

If I select user with all relations like this User::model()->with(‘user_details’, ‘city’, ‘country’)->findAll($CDbCriteria) it all works fine - there`s only 1 query.

But my aim so to use pure SQL to select data into ActiveRecords. And with correct SQL queries (only 1 query where it`s possible).

Here I try findAllBySql and I see that there`s no way to make Yii fetch all data for all related records at once - it ties related records with another query.

Is it correct?

But my aim is to find a way how to fetch related records from one portion of DB data.

Probably someone could tell me an existing decision?

My current dicision is to make some extension to ActiveRecord and make queries like

SELECT user.nick as "user.nick", city.id as "city.id" …

then fetch those columns to different relations.

P.S. Sorry for my english) Thanx