You are here

protected function CreateStubs::processContentEntities in Acquia Content Hub 8.2

Process content entities.

Parameters

array $unprocessed: The unprocessed array.

\Drupal\acquia_contenthub\Event\FailedImportEvent $event: The event object.

\Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher: The dispatcher.

Return value

array The CDFs.

Throws

\Exception

1 call to CreateStubs::processContentEntities()
CreateStubs::handleEntityProcessing in src/EventSubscriber/ImportFailure/CreateStubs.php
Process entities and handle exceptions.

File

src/EventSubscriber/ImportFailure/CreateStubs.php, line 152

Class

CreateStubs
Class CreateStubs.

Namespace

Drupal\acquia_contenthub\EventSubscriber\ImportFailure

Code

protected function processContentEntities(array $unprocessed, FailedImportEvent $event, EventDispatcherInterface $dispatcher) : array {
  $cdfs = [];
  foreach ($unprocessed as $key => $uuid) {
    $cdf = $event
      ->getCdf()
      ->getCdfEntity($uuid);
    $stack = $event
      ->getStack();
    $load_event = new LoadLocalEntityEvent($cdf, $stack);
    $dispatcher
      ->dispatch(AcquiaContentHubEvents::LOAD_LOCAL_ENTITY, $load_event);
    $entity = $load_event
      ->getEntity() ?? $this
      ->createStub($cdf, $uuid, $stack, $dispatcher);
    $wrapper = new DependentEntityWrapper($entity, TRUE);
    $wrapper
      ->setRemoteUuid($uuid);
    $stack
      ->addDependency($wrapper);
    $cdfs[] = $cdf;
  }
  return $cdfs;
}