multiple attributes in listData/DropDownList

Let’s say we need to make the text attribute in the list consist of both first_name and last_name from the Test model. What is the recommended/Yii way to do that?
In the model:

   public function getFullName()
      return $this->firstname . " " . $this->lastname;

a getter function cannot be assigned to, its value can always be fetched from anywhere in the code, including in CHtml::listData when creating a dropdown list. It’s quite common to want to display multiple parts of a model record to the user even though it nevertheless selects just a single ID:
in a view somewhere :

  echo $form->dropDownList($model, 'personid',
    CHtml::listData( Person::model()->findAll(), 'id', 'fullname' )

If you show data on other model attributes then join model with this
model that is like this below :

  echo $form->dropDownList($model, 'personid',
    CHtml::listData( Person::model()->with("relational model name")->findAll(), 'id', 'fullname' ) );

Now, the dropdown will show full user names in the dropdown, which makes for a better user experience. Attempting to provide a dropdown including firstname + lastname without a model helper function like this is more work and less useful.

EXTRA BONUS – In the future, if you add a MiddleName to the Person database table, you only have to modify the getFullname() method in order to automatically update all the views that use $model->fullname.

This is in addition to the benefit of $model->fullname being more clear in the first place.

If you details to this please visit below this yii wiki.