You are here

private function Exporter::getEntityIdsForExport in Default Content Deploy 8

Get all entity IDs for export.

Return value

array Return array of entity ids.

Throws

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

2 calls to Exporter::getEntityIdsForExport()
Exporter::prepareToExport in src/Exporter.php
Prepare content to export.
Exporter::prepareToExportWithReference in src/Exporter.php
Prepare content with reference to export.

File

src/Exporter.php, line 400

Class

Exporter
A service for handling export of default content.

Namespace

Drupal\default_content_deploy

Code

private function getEntityIdsForExport() {
  $skip_entities = $this->skipEntityIds;
  $entity_ids = $this->entityIds;
  $entity_type = $this->entityTypeId;
  $entity_bundle = $this->bundle;
  $key_bundle = $this->entityTypeManager
    ->getDefinition($entity_type)
    ->getKey('bundle');

  // If the Entity IDs option is null then load all IDs.
  if (empty($entity_ids)) {
    $query = $this->entityTypeManager
      ->getStorage($entity_type)
      ->getQuery();
    if ($entity_bundle) {
      $query
        ->condition($key_bundle, $entity_bundle);
    }
    $entity_ids = $query
      ->execute();
  }

  // Remove skipped entities from $exported_entity_ids.
  if (!empty($skip_entities)) {
    $entity_ids = array_diff($entity_ids, $skip_entities);
  }
  return $entity_ids;
}