You are here

private function Exporter::prepareToExportWithReference in Default Content Deploy 8

Prepare content with reference to export.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

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

File

src/Exporter.php, line 345

Class

Exporter
A service for handling export of default content.

Namespace

Drupal\default_content_deploy

Code

private function prepareToExportWithReference() {
  $entity_type = $this->entityTypeId;
  $exported_entity_ids = $this
    ->getEntityIdsForExport();
  if ($this->forceUpdate) {
    $this->fileSystem
      ->deleteRecursive($this
      ->getFolder());
  }
  foreach ($exported_entity_ids as $entity_id) {

    /** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
    $entity = $this->entityTypeManager
      ->getStorage($entity_type)
      ->load($entity_id);
    $exported_entity = $this
      ->getSerializedContentWithReferences($entity);
    $this
      ->addExportedEntity($exported_entity);
  }
}