I have two tables, 1. Students
2.SrkParents.
relations in Students model is,
'srkParents' => array(self::HAS_MANY, 'SrkParents', 'studentID'),
relations in SrkParents model is,
'student' => array(self::BELONGS_TO, 'Students', 'studentID'),
view is,
<?php $this->widget('zii.widgets.grid.CGridView', array(
'id'=>'students-grid',
'dataProvider'=>$dataProvider,
'filter'=>$model,
'columns'=>array('studentID','status','del',
array('name'=>'SrkParents.fathers_name',
'value'=>'$data->Students->fathers_name',
'type'=>'raw'),
array('class'=>'CButtonColumn',),),));
I dont know where i did mistake.. I get the error as shown below,
Property "Students.Students" is not defined.
Modified Answer: Just change the relation has_one from has_many
'srkParents' => array(self::HAS_ONE, 'SrkParents', 'studentID'),