You are here

public function ImportEntityManager::addEntityToImportQueue in Acquia Content Hub 8

Add the UUID to the import queue.

Parameters

string $uuid: The UUID of the Entity to save.

bool $include_dependencies: TRUE if we want to save all its dependencies, FALSE otherwise.

string $author: The UUID of the author (user) that will own the entity.

int $status: The publishing status of the entity (Applies to nodes).

Return value

\Symfony\Component\HttpFoundation\JsonResponse A valid response.

1 call to ImportEntityManager::addEntityToImportQueue()
ImportEntityManager::import in src/ImportEntityManager.php
Import an entity.

File

src/ImportEntityManager.php, line 998

Class

ImportEntityManager
Provides a service for managing imported entities' actions.

Namespace

Drupal\acquia_contenthub

Code

public function addEntityToImportQueue($uuid, $include_dependencies = TRUE, $author = NULL, $status = 0) {
  $item = (object) [
    'data' => [],
  ];
  $item->data[] = new ImportQueueItem($uuid, $include_dependencies, $author, $status);
  $queue = $this->queue
    ->get('acquia_contenthub_import_queue');
  if ($queue
    ->createItem($item)) {
    return new JsonResponse([
      'status' => 200,
      'message' => $uuid . ' added to the queue',
    ], 200);
  }
  return $this
    ->jsonErrorResponseMessage('Unable to add ' . $uuid . ' to the import queue', FALSE);
}