public function ContentHubCommonActions::getRemoteEntity in Acquia Content Hub 8.2
Get the remote entity CDFObject if available.
Parameters
string $uuid: The uuid of the remote entity to retrieve.
Return value
\Acquia\ContentHubClient\CDF\CDFObjectInterface|null CDFObject if found, null on caught exception.
1 call to ContentHubCommonActions::getRemoteEntity()
- ContentHubCommonActions::deleteRemoteEntity in src/
ContentHubCommonActions.php - Delete a remote entity if we own it.
File
- src/
ContentHubCommonActions.php, line 306
Class
- ContentHubCommonActions
- Common actions across the entirety of Content Hub.
Namespace
Drupal\acquia_contenthubCode
public function getRemoteEntity(string $uuid) {
try {
$client = $this
->getClient();
$entity = $client
->getEntity($uuid);
if (!$entity instanceof CDFObjectInterface) {
if (isset($entity['error']['message'])) {
throw new \Exception($entity['error']['message']);
}
throw new \Exception('Unexpected error.');
}
return $entity;
} catch (\Exception $e) {
$this->channel
->error('Error during remote entity retrieval: @error_message', [
'@error_message' => $e
->getMessage(),
]);
}
return NULL;
}