title: Yii gridview use outside variable in value
body: <p>I have a function in my Teacher model which returns categories array.</p>
  
  <pre><code>getCaterogies() {
     return array('1' =&gt; 'short tempered', '2' =&gt; 'funny', '3' =&gt; 'visionary', ...);
  }
  </code></pre>
  
  <p>I am storing indexes in database and displaying values everywhere using the value of the array corresponding to that..</p>
  
  <pre><code>$categories = $teacher-&gt;categories;
  $category = $categories[$teacher-&gt;category];
  </code></pre>
  
  <p>I am doing this because once somebody suggested to me not to store strings in a database which are statuses, instead store integer values, and either store the conversion in the database or define it in ht model. The problem with strings is that they are more prone to human errors in comparisons. Maybe because of case sensitiveness.</p>
  
  <p>Now the problem I am facing is that while displaying values in gridview, I need to write the 2 lines in a value field, but it is an expression, and outside variables also it doesn't take.</p>
  
  <p>How can I get this working for gridview?</p>