Hello Friends,
Relation with state table.
return array(
'relState'=>array(self::HAS_ONE,'State','state_id'),
);
$Data Container for contact detail with state table relation.
$DataProvider = new CActiveDataProvider ('Contact', array(
'criteria' => array (
'with' => array ('relState')
) ,
'pagination' => array('PageSize' => 20, )
));
return $DataProvider;
I am using above code and i am getting correct output. The only thing is that i am getting all records of contact table not from state.
I am having state field in contact table and it is storing state id as foreign key while state table has state_id as primary key. I want to replace state id with state name in all records. But when i am using CActiveDataProvider, i can not achieve this and getting only records of contact table.
So Please help me if anybody has solved this issue.
Thanks in advance…