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);
     }
 }
예제 #2
0
 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);
 }
예제 #3
0
 public function save($isAsync = false)
 {
     parent::save($isAsync);
 }
예제 #4
0
 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);
 }
예제 #6
0
 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);
 }