You are here

protected function JsonWriterTrait::writeJson in Content Synchronizer 8

Same name and namespace in other branches
  1. 8.2 src/Base/JsonWriterTrait.php \Drupal\content_synchronizer\Base\JsonWriterTrait::writeJson()
  2. 3.x src/Base/JsonWriterTrait.php \Drupal\content_synchronizer\Base\JsonWriterTrait::writeJson()

Save json in the destination file.

3 calls to JsonWriterTrait::writeJson()
ExportEntityWriter::addRootEntity in src/Processors/ExportEntityWriter.php
Add the entity to the exported root entities list.
ExportEntityWriter::write in src/Processors/ExportEntityWriter.php
Write the document to export.
ImportEntity::setGidStatus in src/Entity/ImportEntity.php
Set the status of the entity.

File

src/Base/JsonWriterTrait.php, line 13

Class

JsonWriterTrait
Json writer tool.

Namespace

Drupal\content_synchronizer\Base

Code

protected function writeJson($data, $destination) {

  // Create dir :
  $dir = explode('/', $destination);
  array_pop($dir);
  $dir = implode('/', $dir);
  $this
    ->createDirectory($dir);
  file_save_data(json_encode($data), $destination, FILE_EXISTS_REPLACE);
}