/**
  * Dumps the data in .json file.
  *
  * @param string $dumpFileName The name of file in which we dump data.
  */
 public function dumpData($dumpFileName)
 {
     $this->config->readConfigFile($this->config->fileName);
     $this->generateData();
     $this->dump();
     StaticCommand::writeTwoPhases($dumpFileName, json_encode($this->dumpedData, JSON_PRETTY_PRINT), $this->io);
     $f_name = explode('.', $dumpFileName);
     $f_name[0] = $f_name[0] . "-id";
     $uuid_filename = implode('.', $f_name);
     StaticCommand::writeTwoPhases($uuid_filename, json_encode($this->uuidData, JSON_PRETTY_PRINT), $this->io);
 }
Example #2
0
 /**
  * Writes changes in config file.
  *
  * @param MySql\DataLayer $dataLayer
  *
  * @throws RuntimeException
  */
 public function updateConfigFile($dataLayer)
 {
     // Fill table list if we haven't got list of tables in config file.
     if (!count($this->data['tables'])) {
         $this->getTablesList($dataLayer);
     }
     // Set metadata.
     $this->metadata = new Metadata();
     $this->metadata->generateMetadata($dataLayer, $this->data);
     $this->data['metadata'] = $this->metadata->insertMetadata();
     // Write into config file.
     StaticCommand::writeTwoPhases($this->fileName, json_encode($this->data, JSON_PRETTY_PRINT), $this->io);
 }