I have a hard time finding out why this doesn’t work or how it should. In CGridView, I have a column where I want to modify the value with a getter function from a model I have loaded. But this doesn’t work:
array( 'name' => 'answer', 'type' => 'raw', 'value' => '$model->getAnswerText("$data->answer")', ),
This gives me
Fatal error: Call to a member function getAnswerText() on a non-object in C:\xampp\htdocs\yii-1.1.10\framework\base\CComponent.php(607) : eval()'d code on line 1
This, of course does not work, either:
array( 'name' => 'answer', 'type' => 'raw', 'value' => $model->getAnswerText('$data->answer'), ),
$data->answer is a a string with the value $data->asnwer. Without quotation marks, it is null.
It seems like the first case should work, but somehow the evaluation fails. But $model is an object! Does it stop being an object, when the widget is run? This is really odd.