What Class should I use in order to build my model with the Query Builder DB access?

I want to build my own queries…

So - I don’t want my Model to use the CActiveRecord Class.

and it is not a form so CFormModel is not good either…

What Class should I use in order to build my model with the Query Builder DB access?

Just extend CModel and then implement your own methods using queries via the query builder

P.S.: That makes sense if it is a really simple model. If however you are doing more advanced stuff then extend CActiveRecord instead and create your own custom methods that use the query builder like


public function customfindByPk()

{

    //build query and return recordset here

}

This way you have direct access to table columns etc. via CActiveRecords methods which makes things a lot easier

Is there an example somewhere out there?

I want to know how to implement the field validators along with the query builder.

The field validators should work anyway. They are used when an attribute is set via setAttributes() or via $model->validate(), not on inert or update. So that should not be a problem. If you want to be really sure that the attributes are valid you could also use if($this->validate()) in your custom method.

thanks,

this article also helped me to better understand