my own model?

I have a question about building my own model instead of extending CFormModel or CActiveRecord because my lagacy db scheme is so messy. Although MySQL is RDBMS, the scheme hasn’t been designed relationally and properly.

I’m trying to develop web application with Yii and legacy db scheme.

However, it doesn’t seem to be good that I use DAO sql queries on controllers. I would like to have a separate model.

which way could be the best?

may be extend CModel class (http://www.yiiframework.com/doc/api/1.1/CModel) and write your own activerecord.