I am having trouble getting eager loading to work.
The relations in my model are defined as follows:
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'assignedTo' => array(self::BELONGS_TO, 'User', 'assigned_to'),
'devRequest' => array(self::BELONGS_TO, 'DevRequest', 'dev_request_id'),
'updatedBy' => array(self::BELONGS_TO, 'User', 'updated_by'),
);
}
In my controller I have:
$criteria = new CDbCriteria();
$criteria->with = array('assignedTo', 'devRequest', 'updatedBy');
$criteria->together = true;
$dataProvider=new CActiveDataProvider('RequestStatus', array('criteria' => $criteria));
When I view the MySQL logs, I can see a query being executed for each ‘RequestStatus’ record.
How to use eager loading in this scenario? Thanks.