Problem with htmloptions in dropdownlist Yii1.1

I use Yii 1.1 and I have a question for the dropdownlist. I try to set an extra attribute besides the classic value in the options tags.

The data are coming with queries from the database.

The problem is that I manage to set the extra attribute but it seems that the extra attribute for the first options tag is not displayed.

οπτιονλιστ

Here is my code in the view part:


        $types_list = CHtml::listData($model->getTypesnewCodes(),'id','description');
                    
                    
                 $flg = $model->getTypesnewCodesflg();
                    
                 $htmlOptions = array(
                        'prompt' => ("- Select an option -"),
                        'options' =>  $flg,
                    );
            
           echo $form->labelEx($model, 'TypeId');
           echo $form->dropDownList($model,'TypeId',$types_list, $htmlOptions);

Here is my code in the model:

    public function getTypesnewCodesflg() {
            $array =array();
            $typesflg = Yii::app()->db->createCommand()
            ->select( 'id,flag')
            ->from('Types')
            ->queryAll();
        
           
            array_push($array, $typesflg );
    
            
            return $array[0];
        }

The problem was in the database. I had five records with id from 1 to 5 and when I changed the id’s from 0 to 4 it worked.

So be careful with the declaration of the id’s!