You are here

public function ImportService::importFromUrl in Entity Share 8.3

Import the entities from a prepared JSON:API URL.

Parameters

string $url: The JSON:API URL.

Return value

int[] The list of entity IDs imported keyed by UUIDs.

Overrides ImportServiceInterface::importFromUrl

1 call to ImportService::importFromUrl()
ImportService::importEntities in modules/entity_share_client/src/Service/ImportService.php
Plugin annotation @SuppressWarnings(PHPMD . BooleanArgumentFlag);

File

modules/entity_share_client/src/Service/ImportService.php, line 237

Class

ImportService
Class ImportService.

Namespace

Drupal\entity_share_client\Service

Code

public function importFromUrl(string $url) {
  $response = $this
    ->jsonApiRequest('GET', $url);
  $json = Json::decode((string) $response
    ->getBody());
  if (!isset($json['data'])) {
    return [];
  }
  $entity_list_data = EntityShareUtility::prepareData($json['data']);
  return $this
    ->importEntityListData($entity_list_data);
}