ECSVExport Yii extenstion - can not get related columns
I'm tying to export my data to CSV using Yii's ECSVExport extension
My ActiveRecord model has the following relation:
'machinesUsed' => array(self::STAT, 'TRegisteredMachine', 'sub_sid')
Here is how I create my data provider:
$criteria = new CDbCriteria;
$criteria->with = array('machinesUsed');
$criteria->together = true;
$dataProvider = new CActiveDataProvider($this, array(
'criteria' => $criteria));
here is how I try to get CSV
$csv = new ECSVExport($dataProvider);
But I do not see related column in the output data. The extension's page
has some post about related columns. But I have no idea on how to use it
in my situation:
$csv = new ECSVExport($criteria);
$csv->dontConvertProvider();
// whatever columns you want
$csv->setModelRelations(array('subid'=>'name','campaign'=>'name'));
// OR $subid->name, $subid->value, $subid->foo, $subid->bar etc.
$csv->setModelRelations(array('subid'=>array('name','value','foo','bar')));
No comments:
Post a Comment