title: Run function inside CHtml::listData - yii
body: <p>I am trying to list values from a treview in a dropdown list, in Yii. 
  So, i already have a function to concatenate the treeview in path like (example primary\secondary\terciary.
  I call this function passing the ID from the data and the function select the parents, creating list from the database. </p>
  
  <pre><code>public static function getPath($id) {
  
          $post=PlanoAssunto::model()-&gt;find('id=:id', array(':id'=&gt;$id));
  
          if ($post-&gt;id_pai == null) {
          $row=$post-&gt;assunto;
          $data= $row;       
          }
          else {
          $row=$post-&gt;assunto;
          $row=PlanoAssunto::getPath($post-&gt;id_pai).'/'.$row;
          $data= $row;}
  
          if (isset($data)) { 
              return $data;     
              }
              else { 
                  $data = 'Nulo';
                  return $data;  
              }               
  }
  </code></pre>
  
  <p>This work fine in a view, using this: </p>
  
  <pre><code>&lt;?php echo $form-&gt;labelEx($model,'id_pai');?&gt;
  
          &lt;?php   if (isset($_GET['id'])){
                  echo  PlanoAssunto::model()-&gt;getPath($_GET['id']); }
                  else { echo "Novo Assunto Principal";}
          ?&gt;
  </code></pre>
  
  <p>But now i want to populate a select, in the form, with the path list. And I cant run functions inside CHtml::listData. 
  I am trying with this ih the model, with no success: </p>
  
  <pre><code>public static function getTypeOptions() {   
      return  CHtml::listData(PlanoAssunto::model()-&gt;findAll(),'id','getPath($id)');           
  }
  </code></pre>
  
  <p>So, what I am doing wrong? I cant manage a way to put a treeview in path format in the value, associated to his id in database. </p>
  
  <p>I cant figure how I can fill the values in ListData, my HTML returns the IDs, but with any data in value. </p>
  
  <pre><code> &lt;select name="Areaxplanoassunto[idAssunto]" id="Areaxplanoassunto_idAssunto"&gt;
  &lt;option value="1"&gt;&lt;/option&gt;
  &lt;option value="2"&gt;&lt;/option&gt;
  &lt;option value="3"&gt;&lt;/option&gt;
  &lt;option value="4"&gt;&lt;/option&gt;
  &lt;option value="5"&gt;&lt;/option&gt;
  &lt;option value="6"&gt;&lt;/option&gt;
  &lt;option value="7"&gt;&lt;/option&gt;
  &lt;option value="9"&gt;&lt;/option&gt;
  &lt;option value="10"&gt;&lt;/option&gt;
  &lt;option value="11"&gt;&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>Tks. (I am from Brasil, so sorry for the english)</p>