PHP notice

Trying to get property of non-object

/mnt/storage/setnekretnine/protected/controllers/ObjectController.php(47)

35     public function actionGallery($building_id)
36     {
37         $building = Building::model()->with('city')->findByPk($building_id);
38         $all_galleries = null;
39         if(!empty($building->gallery))
40         {
41             $all_galleries = $building->gallery(array(
42                 'order' => 'gallery_date DESC NULLS LAST'
43             ));
44         }
45         
46         $header = $this->renderPartial('header',array(
47             'building_name' => $building->name,
48             'build_id' => $building_id,
49             'city_name' => $building->city->DisplayName,
50             'active_page' => 'object/gallery',
51             'model' =>$building
52         ),true);
53         $this->render('gallery', array(
54             'header' => $header,
55             'model'=>$building,
56             'all_galleries'=>$all_galleries
57         ));
58     }
59     

Stack Trace

#14
+
 /mnt/storage/setnekretnine/index.php(24): CApplication->run()
19 // specify how many levels of call stack should be shown in each log message
20 defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL',3);
21 
22 require_once($yii);
23 
24 Yii::createWebApplication($config)->run();
25 
26 // Yii::app()->session['aaaa']=1;
27 // if (isset(Yii::app()->session['aaaa'])) Yii::app()->session['aaaa']=Yii::app()->session['aaaa']+1;
28 // else Yii::app()->session['aaaa']=1;
29 // echo Yii::app()->session['aaaa'];
2024-03-19 05:08:29 Apache/2.2.15 (CentOS) Yii Framework/1.1.14