PHP notice

Trying to get property of non-object

/data/web/www.amjedu.com/protected/models/Goods.php(134)

122     }
123 
124     public function addInfo($arr){
125         $model = new self();
126         foreach($arr as $k=>$v){
127             $model->$k = $v;
128         }
129         $res =  $model->insert();
130         return $res;
131     }
132     public function getOne($id){
133         $res =  $this->findByPk($id);
134         return $res->attributes;
135     }
136     public function updateInfo($arr){
137         $model = new self();
138         return $model->updateByPk($arr['gid'],$arr);
139     }
140 }

Stack Trace

#0
+
 /data/web/www.amjedu.com/protected/controllers/CourseController.php(56): Goods->getOne("430")
51     public function actionDetail()
52     {
53         
54         $gid = getParam('id','');
55         $this->curNav = 'course';
56         $data['goods'] = $this->_goods_model->getOne($gid);
57         $data['curNav'] = $this->curNav;
58 
59         $bookids = '0';
60         $goodsBookList = $this->_goodsBook_model->getBookListByGoods($gid);
61         foreach($goodsBookList as $value)
#8
+
 /data/web/www.amjedu.com/index.php(10): CApplication->run()
05 $yii=dirname(__FILE__).'../../framework/yii.php';
06 $config=dirname(__FILE__).'/protected/config/main.php';
07 // 包含Yii引导文件
08 require_once($yii);
09 // 创建一个应用实例并执行
10 Yii::createWebApplication($config)->run();
2024-03-29 23:43:26 nginx/1.12.1 Yii Framework/1.1.15