You are here

protected function SubscriberAudit::importEntity in Acquia Content Hub 8

Imports a single entity.

Parameters

string $uuid: The Entity UUID.

string $filter_id: The Filter ID.

Return value

bool|\Symfony\Component\HttpFoundation\JsonResponse The json response or FALSE.

Throws

\Exception

2 calls to SubscriberAudit::importEntity()
SubscriberAudit::executeManifest in acquia_contenthub_audit/src/SubscriberAudit.php
Executes a Manifest file.
SubscriberAudit::importEntities in acquia_contenthub_audit/src/SubscriberAudit.php
Import Entities.

File

acquia_contenthub_audit/src/SubscriberAudit.php, line 375

Class

SubscriberAudit
Audits Subscribers.

Namespace

Drupal\acquia_contenthub_audit

Code

protected function importEntity($uuid, $filter_id) {
  if (empty($this->filters[$filter_id])) {
    print sprintf("There was no filter provided to import entity with UUID = %s .\n", $uuid);
    return FALSE;
  }
  $contenthub_filter = $this->filters[$filter_id];

  // Determine the author UUID for the nodes to be created.
  // Assign the appropriate author for this filter (User UUID).
  $uid = $contenthub_filter->author;
  $user = User::load($uid);

  // Get the Status from the Filter Information.
  $status = $contenthub_filter
    ->getPublishStatus();

  // Re-importing or re-queuing entities matching the filter that were not
  // previously imported.
  return $this->importEntityManager
    ->import($uuid, TRUE, $user
    ->uuid(), $status ? $status : NULL);
}