Is it possible while defining a related Model in an ActiveRecord definition to specify a relation scope that allows only those models to be related whose corresponding column(s) match some predefined critaria in the joining table ?
eg. let us have a users table with fields : id(pk), username(pk),pwd_hash(text), pwd_salt(text)
and an items table : id(pk), itemData(text)
and a correlating table : id(pk),user_id(pk), item_id(pk), some_attribute(int)
Now I would like to define a Many-to-Many relationship such that User Model has a field xitems which would provide me only those items for which the value of some_attribute is greater than some value y. Is it possible to do so using Yii ActiveRecord implementation.
I do understand that I can define a model corresponding to the correlating table which would have belongs-to relation with both items and users and query this table ... but I was looking for a more succinct approach. [edit]
Probably my best bet would be define a model method which abstracts an inner join operation.