Yii1 Excel Importer
Usage
$file = CUploadedFile::getInstanceByName('file');
$importer = new YiiExcelImporter($file->tempName);
$importer->import('PRODUCTO', [
[
'attribute' => 'NOMBRE',
'value' => '$row[0]',
'unique' => true,
],
[
'attribute' => 'FABRICANTE',
'value' => '$row[2]',
]
]);
$importer->import('PRODUCTO_DETAILS', [
[
'attribute' => 'PRODUCTO',
'value' => 'PRODUCTO::model()->findByAttributes(["NOMBRE" => "$row[0]"])->ID'
],
[
'attribute' => 'GRUPO_COMPRES',
'value' => ['$array[$row[0]]['grupo']', ['array' => $some_array_as_param]],
],
]);