I am trying to display a related model attribute ‘assignee’ in my CGridView according to CGriedView Related Model, but I get the error message “Property “Bugs.assignee” is not defined.”.
I have added the property assignee to the model Bugs as
@property string $assignee
In my rules I have the following:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(
array('assigned_to, bug_file_loc, bug_severity, bug_status, delta_ts, short_desc, op_sys, priority, product_id, rep_platform, reporter, version, component_id, status_whiteboard, everconfirmed, cf_comment', 'required'),
array('assigned_to, product_id, reporter, component_id, qa_contact, everconfirmed, reporter_accessible, cclist_accessible, votes', 'numerical', 'integerOnly'=>true),
array('bug_severity, bug_status, op_sys, priority, rep_platform, version, resolution, target_milestone, cf_satisfaction', 'length', 'max'=>64),
array('short_desc', 'length', 'max'=>255),
array('estimated_time, remaining_time', 'length', 'max'=>7),
array('alias', 'length', 'max'=>20),
array('creation_ts, lastdiffed, deadline', 'safe'),
// The following rule is used by search().
// Please remove those attributes that should not be searched.
array('bug_id, assigned_to, assignee, bug_file_loc, bug_severity, bug_status, creation_ts, delta_ts, short_desc, op_sys, priority, product_id, rep_platform, reporter, version, component_id, resolution, target_milestone, qa_contact, status_whiteboard, lastdiffed, everconfirmed, reporter_accessible, cclist_accessible, estimated_time, remaining_time, deadline, alias, votes, cf_satisfaction, cf_comment', 'safe', 'on'=>'search'),
);
}
In my criteria object I have the following:
$criteria=new CDbCriteria;
$criteria->with = array('assignedTo');
$criteria->compare('bug_id',$this->bug_id);
$criteria->compare('assigned_to',$this->assigned_to);
$criteria->compare('assignedTo.login_name', $this->assignee, true);
What am I missing?