Dynamically attaching relationships to CActiveRecord

Is there a way to dynamically add a relation after creating an object of type CActiveRecord? For example, I want to add a HAS_ONE relationship to the class after the model has been created.

Thanks!

The usual way to do is to join the relations using JOIN command. You can use CActiveRecord property called ‘with’, but it has to rely on your existed relations in db.

Have a look at this.