Active Record Relations ?

Hi, :)

i have tables structure like this:

and i want to get data:


product.product_id,product.model, product_description.description,category_description.description[/b]

and i have create relation in my activerecord:


public function relations(){

		return array(





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(





and this code to get data:

$provider = new CActiveDataProvider('TProductDescription',						









but get error:

The relation "category" in active record class "TProductDescription" is specified with an incomplete foreign key. The foreign key must consist of columns referencing both joining tables

this sample for manual:






From product_description as a

left join product as b

on a.product_id = b.product_id

left join product_to_category as c

on b.product_id = c.product_id

left join category_description as d

on c.category_id = d.category_id

WHERE a.language = 1

what is wrong with my code ?

thank you

Hi, any idea ?

hello, anyone ? :)

there may be another way ?

for while I use sql provider

In your SQL code you don’t incorporate any category table (assumed from model TCategory).

Should the relationship look like this? Or, if you intended to use it, is something wrong in the category table?