Hey,
Here’s my situation: I have a table with a relation BELONGS_TO with an id as a foreign key. For now, the CGridView displays this id but I’ld like to :
-
change the name of the column
-
display the name instead of the id
So, I’ve tried this :
array(
'name' => 'project name',
'type' => 'raw',
'value' => Project::model()->findByAttributes(array("id" => $data["project_id"]))->name),
But first, it says that Model.project_name doesn’t exist because it’s projet_id in the model. And then, when I put ‘project_id’ back, it says
“Trying to get property of non-object”. I’ve also tried with a function in the controller but it’s the same.
So any idea for calling a column the way I want and for displaying a value?
Thanks!