protected function RestClient::doGetEncryptionProfile in Salesforce Suite 8.3
Exception-handling wrapper around getEncryptionProfile().
GetEncryptionProfile() will throw an EntityNotFoundException exception if it has an encryption profile ID but cannot load it. In this wrapper we handle that exception by setting a helpful error message and allow execution to proceed.
Return value
\Drupal\encrypt\EncryptionProfileInterface|null The encryption profile if it can be loaded, otherwise NULL.
3 calls to RestClient::doGetEncryptionProfile()
- RestClient::decrypt in modules/
salesforce_encrypt/ src/ Rest/ RestClient.php - Decrypts a value using active encryption profile, or return the same value.
- RestClient::encrypt in modules/
salesforce_encrypt/ src/ Rest/ RestClient.php - Encrypts a value using the active encryption profile, or return plaintext.
- RestClient::_getEncryptionProfile in modules/
salesforce_encrypt/ src/ Rest/ RestClient.php - Deprecated, use doGetEncryptionProfile.
File
- modules/
salesforce_encrypt/ src/ Rest/ RestClient.php, line 191
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce_encrypt\RestCode
protected function doGetEncryptionProfile() {
try {
$profile = $this
->getEncryptionProfile();
} catch (EntityNotFoundException $e) {
drupal_set_message($this
->t('Error while loading encryption profile. You will need to <a href=":encrypt">assign a new encryption profile</a>, then <a href=":oauth">re-authenticate to Salesforce</a>.', [
':encrypt' => Url::fromRoute('salesforce_encrypt.settings')
->toString(),
':oauth' => Url::fromRoute('salesforce.authorize')
->toString(),
]), 'error');
}
return $profile;
}