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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -