You are here

public function Importer::prepareForImport in Default Content Deploy 8

Import data from JSON and create new entities, or update existing.

Return value

$this

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

\Exception

File

src/Importer.php, line 226

Class

Importer
A service for handling import of default content.

Namespace

Drupal\default_content_deploy

Code

public function prepareForImport() {

  // @todo remove because of changes in core >= 9.2
  $this->cache
    ->delete('hal:links:relations');
  $this->files = $this
    ->scan($this
    ->getFolder());
  foreach ($this->files as $file) {
    $uuid = str_replace('.json', '', $file->name);
    if (!isset($this->dataToImport[$uuid])) {
      $this
        ->decodeFile($file);
    }
  }
  return $this;
}