Relational active record and CActiveDataProvider issue.

i have this issue with CActiveDataProvider.

.

I an ActiveRecord ProductTypes and it has the following relations

    public function relations()


{


	// NOTE: you may need to adjust the relation name and the related


	// class name for the relations automatically generated below.


	return array(


              


                'category' => array(self::BELONGS_TO, 'ProductCategories', 'CategoryID'),


                'typeproducts' => array(self::HAS_MANY, 'Products', 'TypeID','condition' => 'typeproducts.Display = 1'),


                );


}

i have the following relational active record and it works like a charm

          $Criteria = new CDbCriteria();





          $Criteria->with = "typeproducts";


          $Criteria->condition = "t.CategoryID = :CategoryID and typeproducts.SupplierID = :SupplierID";


          $Criteria->params = array(":CategoryID" => "12", ":SupplierID" => "2");


          $types = ProductTypes::model()->findAll($Criteria);

and it generates the following query, which is the one i want

system.db.CDbCommand

Querying SQL: SELECT t.TypeID AS t0_c0, t.CategoryID AS t0_c1,

t.Title AS t0_c2, t.Intro AS t0_c3, t.Body AS t0_c4,

t.Image AS t0_c5, t.Thumb AS t0_c6, t.SortOrder AS t0_c7,

t.Display AS t0_c8, typeproducts.ProductID AS t1_c0,

typeproducts.TypeID AS t1_c1, typeproducts.CategoryID AS t1_c2,

typeproducts.SupplierID AS t1_c3, typeproducts.Title AS t1_c4,

typeproducts.Intro AS t1_c5, typeproducts.Body AS t1_c6,

typeproducts.Thumb AS t1_c7, typeproducts.Image AS t1_c8,

typeproducts.FeaturedProduct AS t1_c9,

typeproducts.FeaturedProductText AS t1_c10,

typeproducts.SortOrder AS t1_c11, typeproducts.Display AS

t1_c12 FROM producttypes t LEFT OUTER JOIN products typeproducts

ON (typeproducts.TypeID=t.TypeID) WHERE (t.CategoryID = :CategoryID

and typeproducts.SupplierID = :SupplierID) AND (typeproducts.Display = 1)

[color="#FF0000"]Now when i get the above $Criteria and assign it to my CActiveDataProvider.[/color]

	$dataProvider=new CActiveDataProvider('ProductTypes', array(


                'criteria'=>$Criteria


	));

i get the following error

[color="#FF0000"]CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘typeproducts.SupplierID’ in ‘where clause’[/color]

I dont understand why it does not recognise my column. it seems to work fine with the findAll() command.

I am not sure if this is a bug or i am doing something wrong.

thanks in advance

i found another thread Undestanding Relational Queries with CActiveDataProvider which i used as a fast hack to solve my issue for now.

is there a better way to do this?

can this extension be added in a futere release of yii?? I am sure i am not the only one with this issue

thanks