public function uploadCsv($file, $tableId, $incremental = false) { $sapi = $this->configuration->getStorageApi(); $table = new Table($sapi, $tableId, $file, 'id', false, ',', '"', $incremental); try { $table->save(true); } catch (ClientException $e) { throw new UserException('Error while uploading data to StorageAPI: ' . $e->getMessage(), $e); } }
public function save($data, Sheet $sheet) { $sheetConfig = $sheet->getConfig(); $tmpFilename = $this->writeRawCsv($data, $sheet); $dataProcessor = new DataProcessor($tmpFilename, $sheetConfig); $outFilename = $dataProcessor->process(); $this->configuration->initDataBucket($sheetConfig['db']['table']); $outputTable = $sheetConfig['db']['table']; $tableNameArr = explode('.', $outputTable); if (count($tableNameArr) != 3) { throw new UserException(sprintf("Error in configuration. Wrong tableId format '%s'", $outputTable)); } $table = new Table($this->configuration->getStorageApi(), $outputTable, $outFilename); try { $table->save(true); } catch (ClientException $e) { throw new UserException($e->getMessage(), $e, ['outputTable' => $outputTable, 'sheet' => $sheet->toArray()]); } unlink($tmpFilename); }
public function save($isAsync = false) { parent::save($isAsync); }
public function save($isAsync = false) { $profilesArray = array(); foreach ($this->profiles as $profile) { /** @var Profile $profile */ $profilesArray[] = $profile->toArray(); } $this->setFromArray($profilesArray); parent::save(true); }
public function save($async = false) { $data = array(); /** @var File $file */ foreach ($this->files as $file) { $data[] = $file->toArray(); } $this->setFromArray($data); parent::save($async); }
public function save($isAsync = false) { // Sheets toArray $sheetArray = array(); foreach ($this->sheets as $sheet) { /** @var Sheet $sheet */ $sheetArray[] = $sheet->toArray(); } $this->setFromArray($sheetArray); parent::save($isAsync); }