PHP Error
Description
Trying to get property of non-object
Source File
D:\xampp\htdocs\tackstarts\protected\views\issue\view.php(35)
00023: 'name',
00024: 'description',
00025: array(
00026: 'name'=>'type_id',
00027: 'value'=>CHtml::encode($model->getTypeText())
00028: ),
00029: array(
00030: 'name'=>'status_id',
00031: 'value'=>CHtml::encode($model->getStatusText())
00032: ),
00033: array(
00034: 'name'=>'owner_id',
00035: 'value'=>CHtml::encode($model->owner->username)
00036: ),
00037: array(
00038: 'name'=>'requester_id',
00039: 'value'=>CHtml::encode($model->requester->username)
00040: ),
00041: //'create_time',
00042: //'create_user_id',
00043: //'update_time',
00044: //'update_user_id',
00045: ),
00046: )); ?>
00047: <?php
Stack Trace
#0 D:\xampp\htdocs\tackstarts\framework\web\CBaseController.php(119): require()
#1 D:\xampp\htdocs\tackstarts\framework\web\CBaseController.php(88): IssueController->renderInternal()
#2 D:\xampp\htdocs\tackstarts\framework\web\CController.php(748): IssueController->renderFile()
#3 D:\xampp\htdocs\tackstarts\framework\web\CController.php(687): IssueController->renderPartial()
#4 D:\xampp\htdocs\tackstarts\protected\controllers\IssueController.php(82): IssueController->render()
#5 D:\xampp\htdocs\tackstarts\framework\web\actions\CInlineAction.php(32): IssueController->actionView()
#6 D:\xampp\htdocs\tackstarts\framework\web\CController.php(300): CInlineAction->run()
#7 D:\xampp\htdocs\tackstarts\framework\web\filters\CFilterChain.php(129): IssueController->runAction()
#8 D:\xampp\htdocs\tackstarts\framework\web\filters\CFilter.php(41): CFilterChain->run()
#9 D:\xampp\htdocs\tackstarts\framework\web\CController.php(999): CAccessControlFilter->filter()
#10 D:\xampp\htdocs\tackstarts\framework\web\filters\CInlineFilter.php(59): IssueController->filterAccessControl()
#11 D:\xampp\htdocs\tackstarts\framework\web\filters\CFilterChain.php(126): CInlineFilter->filter()
#12 D:\xampp\htdocs\tackstarts\framework\web\CController.php(283): CFilterChain->run()
#13 D:\xampp\htdocs\tackstarts\framework\web\CController.php(257): IssueController->runActionWithFilters()
#14 D:\xampp\htdocs\tackstarts\framework\web\CWebApplication.php(320): IssueController->run()
#15 D:\xampp\htdocs\tackstarts\framework\web\CWebApplication.php(120): CWebApplication->runController()
#16 D:\xampp\htdocs\tackstarts\framework\base\CApplication.php(135): CWebApplication->processRequest()
#17 D:\xampp\htdocs\tackstarts\index.php(12): CWebApplication->run()
2011-10-07 08:45:11 Apache/2.2.21 (Win32) mod_ssl/2.2.21 OpenSSL/1.0.0e PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1 Yii Framework/1.1.2
mdomba
(Maurizio Domba Cerin)
October 7, 2011, 8:52am
2
Error happens if there is no owner for the issue…
in the line 35 you should change
'value'=>CHtml::encode($model->owner->username)
to
'value'=>$model->owner ? CHtml::encode($model->owner->username) : 'no owner'
windsor
(Davidfaith101)
October 23, 2011, 6:15pm
3
mdomba:
Error happens if there is no owner for the issue…
in the line 35 you should change
'value'=>CHtml::encode($model->owner->username)
to
'value'=>$model->owner ? CHtml::encode($model->owner->username) : 'no owner'
Thanks! Thisone was driving me crazy. Can some one repost this thread to the Agile Yii1.1 Development Book forum where it belongs? The page reference is chapter 6 page 141.