Question Fro Has_Many

Hello all. I’m sorry for maybe a dumb question:

there is a model A with relation to model B and type BELONGS_TO

there is a model B with relation to model C and type HAS_MANY

How the CDbCriteria condition can be altered to search something like this




If anyone can help, I would be much obliged. Excuse my bad English.


check this

  $criteria=new CDbCriteria;

  $criteria->with = array( 'RelatedModel');

  $criteria->compare("RelatedModel.field1", "a value", true);

It works like a charm, thank you very much! I guess I’m still too new in Yii way :)