public function ContentHubEntityExportController::queueExportedEntity in Acquia Content Hub 8
Sets a record for an entity to be queued for export.
Parameters
\Drupal\Core\Entity\ContentEntityInterface $entity: The entity that has to be queued for export.
Throws
\Drupal\Core\Entity\EntityStorageException
1 call to ContentHubEntityExportController::queueExportedEntity()
- ContentHubEntityExportController::exportEntities in src/Controller/ ContentHubEntityExportController.php 
- Export entities to Content Hub (using the queue if enabled).
File
- src/Controller/ ContentHubEntityExportController.php, line 377 
Class
- ContentHubEntityExportController
- Controller for Content Hub Export Entities using bulk upload.
Namespace
Drupal\acquia_contenthub\ControllerCode
public function queueExportedEntity(ContentEntityInterface $entity) {
  $exported_entity = $this->contentHubEntitiesTracking
    ->loadExportedByUuid($entity
    ->uuid());
  if ($exported_entity) {
    $exported_entity
      ->setQueued();
    $this->contentHubEntitiesTracking
      ->save();
    return;
  }
  $entity = $this->entityRepository
    ->loadEntityByUuid($entity
    ->getEntityTypeId(), $entity
    ->uuid());
  if (!$entity) {
    $this->loggerFactory
      ->get('acquia_contenthub')
      ->warning('Cannot create record in the tracking table, because the entity cannot be loaded in Drupal. uuid: @uuid type: @type', [
      '@uuid' => $entity
        ->uuid(),
      '@type' => $entity
        ->getEntityTypeId(),
    ]);
    return;
  }
  // Add a new tracking record with queued status set, and
  // imported status empty.
  $exported_entity = $this->contentHubEntitiesTracking
    ->setExportedEntity($entity
    ->getEntityTypeId(), $entity
    ->id(), $entity
    ->uuid(), date('c'), $this->contentHubEntitiesTracking
    ->getSiteOrigin());
  if (!$exported_entity) {
    $this->loggerFactory
      ->get('acquia_contenthub')
      ->warning('Cannot save into Acquia ContentHub tracking table; entity UUID: @uuid, @backtrack', [
      '@uuid' => $entity
        ->uuid(),
      '@backtrack' => __FUNCTION__,
    ]);
    return;
  }
  $exported_entity
    ->setQueued();
  $this->contentHubEntitiesTracking
    ->save();
}