title: Yii framework - picking up field value from other model
body: <p>I have been struggling with this, i have two models and showing data in Cgridview with one model, this model contains some id's whose values are in different table</p>
  
  <p>So, i have added</p>
  
  <p>'value'=> 'TblAreaoflaw::model()->FindByPk($data->typeoflaw)->areaoflaw'</p>
  
  <p>which is giving this error</p>
  
  <p>"Trying to get property of non-object"</p>
  
  <p>Might be due to this reason that the some records doesn't exist in the TblAreaoflaw. Can't we check in this line through isset?</p>
  
  <p>When i put static value, it work well, like</p>
  
  <p>'value'=> 'TblAreaoflaw::model()->FindByPk(5)->areaoflaw',</p>
  
  <p>Could anyone please help</p>
  
  <p>thanks a lot</p>