You are here

private function Exporter::writeConfigsToFolder in Default Content Deploy 8

Writes an array of serialized entities to a given folder.

Return value

$this

Throws

\Exception

1 call to Exporter::writeConfigsToFolder()
Exporter::export in src/Exporter.php
Export entities by entity type, id or bundle.

File

src/Exporter.php, line 458

Class

Exporter
A service for handling export of default content.

Namespace

Drupal\default_content_deploy

Code

private function writeConfigsToFolder() {
  foreach ($this->exportedEntities as $entity_type => $serialized_entities) {

    // Ensure that the folder per entity type exists.
    $entity_type_folder = "{$this->getFolder()}/{$entity_type}";
    $this->fileSystem
      ->prepareDirectory($entity_type_folder, FileSystemInterface::CREATE_DIRECTORY);
    foreach ($serialized_entities as $uuid => $serialized_entity) {
      file_put_contents("{$entity_type_folder}/{$uuid}.json", $serialized_entity);
    }
  }
  return $this;
}