Yii framework - picking up field value from other model -
i have been struggling this, have 2 models , showing data in cgridview 1 model, model contains id's values in different table
so, have added
'value'=> 'tblareaoflaw::model()->findbypk($data->typeoflaw)->areaoflaw'
which giving error
"trying property of non-object"
might due reason records doesn't exist in tblareaoflaw. can't check in line through isset?
when put static value, work well, like
'value'=> 'tblareaoflaw::model()->findbypk(5)->areaoflaw',
could please help
thanks lot
the error because expression tblareaoflaw::model()->findbypk($data->typeoflaw)
returning null
. means trying null->areaoflaw
won't work (this error message "trying property of non-object" clarifies).
my best guess $data->typeoflaw
returns non-existing primary key tblareaoflaw model.
Comments
Post a Comment