I have data in 3 tables A,B and C, where two of the tables A,B are related to 3rd table C say location. so i want to get data from those two tables A and B in one controller it self. so i have created one model with first table A, there i am trying to make relation of the table B and C but the error comes as
Relation "cost_Location" is not defined in active record class "Costs". the code is as follows :
$criteria = new CDBCriteria;
$criteria->with=array('user_modifyby'=>array('select'=>'username') ,'cost_Location'=>array('select'=>'location_type')); //,'costLocation'=>array('select'=>'location_type')); $arrCosts = Costs::model()->findAll($criteria);
‘user_modifyby’=>array(self::BELONGS_TO, ‘Users’, ‘cost_creator’),
'cost_Location'=>array(self::BELONGS_TO, 'Locations', 'location_id'), );
For first relation it works but as soon as i try to relate 2nd table that is location it gives error. not getting where i am going wrong.
Thanks in advance.