Example #1
0
 /**
  * Write the given database to the disk
  *
  * @param DatabaseInterface $database
  * @throws Exception\WriterException if the data could not be written
  */
 public function writeDatabase($database)
 {
     $this->_prepareWriteDirectory();
     $databaseIdentifier = $database->getIdentifier();
     $path = $this->_getWriteDirectory() . $databaseIdentifier . '.json';
     $result = $this->_writeData($this->_getDataToWrite($database), $path, $databaseIdentifier);
     if ($result === FALSE) {
         throw new WriterException(sprintf('Could not write data from database %s to file "%s"', $database->getIdentifier(), $path), 1410291420);
     }
 }