Show Description From Table

Hi people!

I have an issue:

So I have a user (Table: User) which has a description (Table: UserDescription [idTipoUtilizador (PK), descricaoTipoUtilizador])

Now when I list all users I have only the id values from userDescription, but I want the description.

So in my model I made this:

 public function getTypeOptions(){

            return array (

            $tiposUtilizador = CHtml::listData(Tipoutilizador::model()->findAll(), 'idTipoUtilizador', 'descricaoTipoUtilizador'));



public function getTypeOptionsText (){


                return isset($tipo[$this->idTipoUtilizador]) ? $tipo[$this->idTipoUtilizador] : "unkown status({$tipo->idTipoUtilizador})";




In view I have this:


            'name' => 'idTipoUtilizador',

            'filter' => $model->getTypeOptions(),

            'value' => 'CHtml::encode($data->getTypeOptionsText())',


And I have a error:

Trying to get property of non-object

My guide was this video:

Can someone help me?

Thanks! :D

Oh come on! -.-

Sorry people!!

I return a array! Please -.-’ I solved problem now.


Return only the variable in getTypeOptions.

In view I have a error to:

It’s not

value' => 'CHtml::encode($data->getTypeOptionsText())'

but yes

value' => CHtml::encode($model->getTypeOptionsText())