Hi guys,
I’m trying to get a data provider with 1 to Many relationships and display them in my CGridView.
But I’m getting: Property “Bugs.login_name” is not defined.
How can I get the relationship and display it in my CGridView?
public function search()
{
$criteria = $this->getCriteria();
$criteria->with = array('assignedTo');
$dataProvider = new CActiveDataProvider($this, array(
'criteria'=>$criteria,
));
return $dataProvider;
}
public function relations()
{
return array(
'assignedTo' => array(self::BELONGS_TO, 'Profiles', 'assigned_to'),
);
}
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'bugs-grid',
'dataProvider'=>$model->search(),
'filter'=>$model,
'columns'=>array(
'login_name',
'bug_id',
'bug_file_loc',
'bug_severity',
'bug_status',
'creation_ts',
array(
'class'=>'CButtonColumn',
),
),
));