Extending CDataColumn

Hi!

I am developing an application using Yii 1.1.5.

Now I have extended the CDataColumn. Please check the following extended class.




class DataColumn extends CDataColumn {


    protected function renderDataCellContent($row, $data) {

        if ($this->value !== null) {

            $value = $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));

        } elseif ($this->name !== null) {

            $method = 'get' . ucfirst($this->name);

            

            if (method_exists($data, $method)) {

                $value = $data->$method();

            } else {

                $value = CHtml::value($data, $this->name);

            }

        }

        

        echo $value === null ? $this->grid->nullDisplay : $this->grid->getFormatter()->format($value, $this->type);

    }


}



My only point here to get the value from the getter if exists in the model. Please guide me if there is a better way to implement this.

Thanks & regards.