Cdetialview Value

I have a problem where that my model value equals the word "File" and the CDetailView when calling run causes a error explaining that the function file expect argument 1 to be string and object sent




<?php $this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		'scheduled_task_id',

		'scheduled_task_name',

		'scheduled_task_description',

		'scheduled_task_script',

		'scheduled_task_argument',

		array(

		 	'name'=>'scheduled_task_handle_type',

			'value'=>$model->handleTypeText,

		),

		'scheduled_task_handle',

		'scheduled_task_next_datetime',

		'scheduled_task_prev_datetime',

		 array(

		 	'label'=>'Command',

            'type'=>'raw',

            'value'=>CHtml::link(CHtml::encode('Run'), array('process', 'id'=>$model->scheduled_task_id)),

		),

	),

)); ?>



The handleTypeText is a get function in my model




public function getHandleTypeOptions()

{

	return array(

		'EMAIL'=>'Email',

		'FILE'=>'File',

		'FTP'=>'FTP',

	);

}

	

public function getHandleTypeText()

{

	$typeOptions=$this->handleTypeOptions;

	return isset($typeOptions[$this->scheduled_task_handle_type]) ? $typeOptions[$this->scheduled_task_handle_type] : "unknown type ({$this->scheduled_task_handle_type})";

} 



I came up with a solution by changing the attributes like so.




$this->widget('zii.widgets.CDetailView', array(

	'data'=>$model,

	'attributes'=>array(

		...

		array(

		 	'label'=>$model->getAttributeLabel('scheduled_task_handle_type'),

			'name'=>'handleTypeText',

		),

	);



If anyone has a better solution for this please let me know. It’s kind of frustrating to know that at any point that I defined the attributes value out and the value equals a php function that I will get a error.

This issue has been reported on Github. It is supposed to be fixed in the next version.