How Do You Show The Value Assigned To An Integer From A Lookup Table With Yii?

In my prospect form, I created the value by populating the dropbox from values from a table.


<?php echo $form->dropDownList($model,'status', CHtml::listData(Statusprospect::model()->findAll(), 'id', 'status'),array('prompt' => 'Select')); ?>



When I view the record it has a 1, as it should for status. How do I make it display the value when the record is viewed, instead of the 1.

The view file code that currently displays the field is this:


    <?php echo CHtml::encode($data->status); ?>



The Model does have the relationship defined:




public function relations()

{

    // NOTE: you may need to adjust the relation name and the related

    // class name for the relations automatically generated below.

    return array(

        'status0' => array(self::BELONGS_TO, 'Statusprospect', 'status'),

    );

}



How would I accomplish showing the value instead of the number?

Found it!!!


CHtml::encode(isset($data->status0->status) ? $data->status0->status : '-');