コード例 #1
0
ファイル: Reader.php プロジェクト: keboola/input-mapping
 /**
  * @param $tableInfo
  * @param $destination
  * @throws \Exception
  */
 protected function writeTableManifest($tableInfo, $destination)
 {
     $manifest = array("id" => $tableInfo["id"], "uri" => $tableInfo["uri"], "name" => $tableInfo["name"], "primary_key" => $tableInfo["primaryKey"], "indexed_columns" => $tableInfo["indexedColumns"], "created" => $tableInfo["created"], "last_change_date" => $tableInfo["lastChangeDate"], "last_import_date" => $tableInfo["lastImportDate"], "rows_count" => $tableInfo["rowsCount"], "data_size_bytes" => $tableInfo["dataSizeBytes"], "is_alias" => $tableInfo["isAlias"], "columns" => $tableInfo["columns"], "attributes" => array());
     foreach ($tableInfo["attributes"] as $attribute) {
         $manifest["attributes"][] = array("name" => $attribute["name"], "value" => $attribute["value"], "protected" => $attribute["protected"]);
     }
     if (isset($tableInfo["s3"])) {
         $manifest["s3"] = $tableInfo["s3"];
     }
     $adapter = new TableAdapter($this->getFormat());
     try {
         $adapter->setConfig($manifest);
         $adapter->writeToFile($destination);
     } catch (InvalidInputException $e) {
         throw new InputOperationException("Failed to write manifest for table {$tableInfo['id']} - {$tableInfo['name']}.", $e);
     }
 }