You are here

private function AcquiaContentHubSubscriberAuditCommands::getContentHubTrackedEntities in Acquia Content Hub 8.2

Fetch Content Hub entities from export tracking table.

Parameters

string $status: The status of the entities to audit.

string $entity_type_id: The entity type.

Return value

array Array containing list of entities.

Throws

\Exception

1 call to AcquiaContentHubSubscriberAuditCommands::getContentHubTrackedEntities()
AcquiaContentHubSubscriberAuditCommands::audit in modules/acquia_contenthub_subscriber/src/Commands/AcquiaContentHubSubscriberAuditCommands.php
Audits imported entities and reimport if inconsistencies are found.

File

modules/acquia_contenthub_subscriber/src/Commands/AcquiaContentHubSubscriberAuditCommands.php, line 114

Class

AcquiaContentHubSubscriberAuditCommands
Drush commands for Acquia Content Hub Subscriber Audit.

Namespace

Drupal\acquia_contenthub_subscriber\Commands

Code

private function getContentHubTrackedEntities(string $status, $entity_type_id = '') : array {
  switch ($status) {
    case SubscriberTracker::QUEUED:

      // If we want to queue "queued" entities, then we have to make sure the
      // export queue is empty or we might be re-queuing entities that already
      // are in the queue.
      if ($this->queue
        ->numberOfItems() > 0) {
        throw new \Exception(dt('You cannot audit queued entities when the queue is not empty because you run the risk of re-queuing the same entities. Please retry when the queue is empty.'));
      }
    case SubscriberTracker::IMPORTED:
      $entities = $this->tracker
        ->listTrackedEntities($status, $entity_type_id);
      break;
    default:
      throw new \Exception(dt('You can only use the following values for status: imported, queued.'));
  }
  return $entities;
}