filter in HAS_MANY relation

hey,

I have three tables: house(id, name…), property(id,property_name), house_property(id,house_id, property_id), the item in ‘house’ has many items in ‘house_property’. I want to filter the items of house with the 'property_id, this property is in the house_property table. I declare a relation in house’s model like this:


'property'=>array(self::HAS_MANY, 'house_property', 'house_id', 'joinType'=>' right outer join')

In the controller:




$criteria->with[] = 'property';

$criteria->condition = 'property_id = '.$params_array['property'];



It gave me an error said "no property named property".

I check the log file and found the house_property table doesn’t join to the sql.

Who can help me? Thank you.

ps:because I use CActiveDataProvider for CListView, I must use $criteria->condition for CActiveDataProvider

dose anybody know how to do it?