I have this lines of code…
echo '<pre>';
print_r($data->ProductCategory->prd_cat_name);
die();
…it does show the correct output when "die()" is executed, but, when I remove the "die()" it throws
"Trying to get property of non-object" on the exact same line on "print_r"
Here is my Model relation
public function relations()
{
return array(
'ProductCategory'=>array(self::HAS_ONE, 'ProductCategory', 'prd_cat_id'),
'ProductType'=>array(self::HAS_ONE, 'ProductType', 'prd_typ_id'),
'ProductStyle'=>array(self::HAS_ONE, 'ProductStyle', 'prd_sty_id'),
);
}
Controller
public function actionIndex()
{
$dataProvider=new CActiveDataProvider('Product', array(
'criteria'=>array(
'with'=>array('ProductCategory'),
),
));
$this->render('index',array(
'dataProvider'=>$dataProvider,
));
}