T alias? with Relations

So I want to create a relation with the Primary Table "Business" with a secondary table "BusinessType"

This is inside the Business Class:


'typeOfBusiness' => array(self::HAS_ONE, 'BusinessType', '', 'on' =>'t.businessType=id'),

so I don’t want to compare primary key, I want to use another field for the comparison called businessType.


So basically the join needs to use Business.businessType = BusinessType.id;

instead of Business.id = BusinessType.id;

seems that t is not working here…

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘t.businessType’ in ‘where clause’. The SQL statement executed was: SELECT typeOfBusiness.id AS t1_c0, typeOfBusiness.name AS t1_c1 FROM tbl_businessType typeOfBusiness WHERE (t.businessType=id)

http://www.yiiframework.com/doc/guide/1.1/en/database.arr

So, might be this:




'typeOfBusiness' => array(self::HAS_ONE, 'BusinessType', array('id' => 'businessType')),



awesome thanks!