Problem with showig join table values

I have this very simple table in my view and I’m trying to display value from joined table:

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



	'template' => '{items}{pager}',

	'cssFile'=>Yii::app()->request->baseUrl. '/themes/'. Yii::app()->theme->name.'/css/table.css',

	'htmlOptions'=>array('class'=>'datagrid', 'style'=>'width:550px;'),






			'name' => 'value',

			'header' => Yii::t('MainTrans', 'Value'),

			'value' => '$data->student_skills->value',



			'name' => 'successRate',

			'header' => Yii::t('MainTrans', 'Success Rate'),

			'value' => '$data->successRate."%"',




And this is the search function:

public function searchWithStudentSuccessRate($id)


		// Warning: Please modify the following code to remove attributes that

		// should not be searched.


		$criteria=new CDbCriteria;





		$criteria->with = array('student_skills');

		$criteria->together = true;

		$criteria->select = array('IFNULL(CASE WHEN ROUND((student_skills.value/t.threshold)*100,0) > 100 THEN 100 ELSE ROUND((student_skills.value/t.threshold)*100,0) END,0) as successRate','*');

		$criteria->group = "";

		$criteria->condition = 'student_skills.student_id = '.$id;






		return new CActiveDataProvider($this, array(












										'desc'=>'successRate DESC',







But I get error: "Trying to get property of non-object" when I added value column to my CGridView.

Everything works fine without column value (columns successRate and name are fine). Relation should be fine as well. The error I get means that the value doesn’t exist but it should since I did something similar in my other views and there it works.

Can anyone tell what’s wrong? I’m sure it’s something minor but I’m struggling with this embarrasing problem for a while.


Could it be the header element for column ‘value’ that is the problem? Try commend that out to see.

you can do this


         'name' => 'value',

         'header' => Yii::t('MainTrans', 'Value'),

         'value' => 'is_null($data->student_skills) ? '' : $data->student_skills->value',



are you sure that "value" is name of column in other table??