smile4o
(Smilecho)
1
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
A->search(){
B->C[0]->some_field
}
If anyone can help, I would be much obliged. Excuse my bad English.
konapaz
(Konapaz)
2
Hi,
check this
$criteria=new CDbCriteria;
$criteria->with = array( 'RelatedModel');
$criteria->compare("RelatedModel.field1", "a value", true);
smile4o
(Smilecho)
3
It works like a charm, thank you very much! I guess I’m still too new in Yii way 