Cactivedataprovider With Relations And Scopes - Stucked With Alias Table Names

Im new in yii and , of course <img src='http://www.yiiframework.com/forum/public/style_emoticons/default/unsure.gif' class='bbc_emoticon' alt=':unsure:' /> , Im stucked with an error and I don`t know how to resolve it. My code is:


...

$criteria = new CDbCriteria;

$criteria->addSearchCondition('stadium.town', $town, false);

$criteria->addSearchCondition('scorer.name', $name, false);

$criteria->addSearchCondition('match_type', $match_type, false);


$dp = new CActiveDataProvider(Match::model()->with('stadium', 'scorer')->played()->victories(), 

	array(

		"pagination" => array(

			"pageSize" => Yii::app()->params['matches_per_page']

		)

	)

);

When I tried this:


$dp->model->setDbCriteria($criteria);

I got the following error message:


 Column not found: 1054 Unknown column 'stadium.town' in 'where clause'.


with('stadium', 'scorer')

these are my relations name defined in Match model.

Try setting the together property of your CDbCriteria object to true. This will enable eager loading, that is force a join and allow to refer to the related tables in query conditions.