Problem with BELONGS_TO and html htmlspecialchars()

Hello, i’m having some trouble with FK and related data on yii.

Here is my table structure:


Users:        Events:            Events_ocurred:


id_user(PK)   id_events(PK)      id (PK)

username      description        id_events (FK)

                                 id_user (FK)

                                 date

id_events on Events and Events_ocurred are type VARCHAR(11) because on my system 0049 != 00049 (i need to to this way)

so, on EventsOcurred Model:


public function relations()

	{

	'username' => array (self::BELONGS_TO, 'Usuario', 'id_user'),

	'description' => array (self::BELONGS_TO, 'Events', 'id_events'),

);

	}

On EventsOcurred View:


<b><?php echo CHtml::encode($data->getAttributeLabel('Name of Event')); ?>:</b>

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

	<br />


	<b><?php echo CHtml::encode($data->getAttributeLabel('User')); ?>:</b>

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

	<br />

If i change description -> description i got a blank field, if i put as i told, i got this:


htmlspecialchars() expects parameter 1 to be string, object given 

username -> username returns fine the name of user…


Just one more thing that i got from source when i try to print_r($data)


[relations] => Array

                (

                    [usuario] => CBelongsToRelation Object

                        (

                            [joinType] => LEFT OUTER JOIN

                            [on] => 

                            [alias] => 

                            [with] => Array

                                (

                                )


                            [together] => 

                            [name] => users

                            [className] => Users

                            [foreignKey] => id_user

                            [select] => *

                            [condition] => 

                            [params] => Array

                                (

                                )


                            [group] => 

                            [join] => 

                            [having] => 

                            [order] => 

                            [_e:CComponent:private] => 

                            [_m:CComponent:private] => 

                        )


                    [descricao] => CBelongsToRelation Object

                        (

                            [joinType] => LEFT OUTER JOIN

                            [on] => 

                            [alias] => 

                            [with] => Array

                                (

                                )


                            [together] => 

                            [name] => description

                            [className] => Events

                            [foreignKey] => id_events

                            [select] => *

                            [condition] => 

                            [params] => Array

                                (

                                )


                            [group] => 

                            [join] => 

                            [having] => 

                            [order] => 

                            [_e:CComponent:private] => 

                            [_m:CComponent:private] => 

                        )


                )

Why this work for users but not on events?