You are here

private function ImportEntityManager::getRemoteDependencies in Acquia Content Hub 8

Obtains First-level remote dependencies for the current Content Hub Entity.

Parameters

\Drupal\acquia_contenthub\ContentHubEntityDependency $content_hub_entity: The Content Hub Entity.

bool|true $use_chain: If the dependencies should be unique to the dependency chain or not.

Return value

array An array of \Drupal\acquia_contenthub\ContentHubEntityDependency.

1 call to ImportEntityManager::getRemoteDependencies()
ImportEntityManager::getAllRemoteDependencies in src/ImportEntityManager.php
Obtains all dependencies for the current Content Hub Entity.

File

src/ImportEntityManager.php, line 374

Class

ImportEntityManager
Provides a service for managing imported entities' actions.

Namespace

Drupal\acquia_contenthub

Code

private function getRemoteDependencies(ContentHubEntityDependency $content_hub_entity, $use_chain = TRUE) {
  $dependencies = [];
  $uuids = $content_hub_entity
    ->getRemoteDependencies();
  foreach ($uuids as $uuid) {
    $content_hub_dependent_entity = $this
      ->loadRemoteEntity($uuid);
    if ($content_hub_dependent_entity === FALSE) {
      continue;
    }

    // If this dependency is already tracked in the dependency chain
    // then we don't need to consider it a dependency unless we're not using
    // the chain.
    if ($content_hub_entity
      ->isInDependencyChain($content_hub_dependent_entity) && $use_chain) {
      $content_hub_dependent_entity
        ->setParent($content_hub_entity);
      continue;
    }
    $content_hub_dependent_entity
      ->setParent($content_hub_entity);
    $dependencies[$uuid] = $content_hub_dependent_entity;
  }
  return $dependencies;
}