You are here

protected function ContentHubCommonActions::getMissingDependencies in Acquia Content Hub 8.2

Gets missing dependencies from CDFObjects within a CDFDocument.

Parameters

\Acquia\ContentHubClient\CDFDocument $document: The document from which to identify missing dependencies.

Return value

array The array of missing uuids.

1 call to ContentHubCommonActions::getMissingDependencies()
ContentHubCommonActions::getCdfDocument in src/ContentHubCommonActions.php
Retrieves entities and dependencies by uuid and returns a CDFDocument.

File

src/ContentHubCommonActions.php, line 282

Class

ContentHubCommonActions
Common actions across the entirety of Content Hub.

Namespace

Drupal\acquia_contenthub

Code

protected function getMissingDependencies(CDFDocument $document) {
  $missing_dependencies = [];
  foreach ($document
    ->getEntities() as $cdf) {

    // @todo add the hash to the CDF so that we can check it here to see if we need to update.
    foreach ($cdf
      ->getDependencies() as $dependency => $hash) {

      // If the document doesn't have a version of this dependency, it might
      // be missing.
      if (!$document
        ->hasEntity($dependency)) {
        $missing_dependencies[$dependency] = $dependency;
      }
    }
  }
  return $missing_dependencies;
}