我有以下方法:
public function actionIndex() {
$companyModel = Company::model()->findAll();
$supplierProductModel = SupplierProduct::model()->findAll();
$this->render('index', array(
'companyData' => $companyModel,
'supplierProductData' => $supplierProductModel,
));
}
在这里,我已将模型对象传递给渲染函数,并希望在视图中访问这些对象(活动关系类型),但是当我在视图中访问它时,它显示错误:
Trying to get property of non-object
查看文件(index.php)
echo $companyData->name . "\n";
echo $this->companyModel->phone . "\n";
echo $this->companyModel->fax . "\n";
echo $this->companyModel->cell . "\n";
任何帮助,将不胜感激。