public function RestClient::getObjectTypeName in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getObjectTypeName()
- 8.3 src/Rest/RestClient.php \Drupal\salesforce\Rest\RestClient::getObjectTypeName()
Utility function to determine object type for given SFID.
Parameters
\Drupal\salesforce\SFID $id: The SFID.
Return value
string|false The object type name, or FALSE if not found.
Overrides RestClientInterface::getObjectTypeName
File
- src/
Rest/ RestClient.php, line 642
Class
- RestClient
- Objects, properties, and methods to communicate with the Salesforce REST API.
Namespace
Drupal\salesforce\RestCode
public function getObjectTypeName(SFID $id) {
$prefix = substr((string) $id, 0, 3);
$describe = $this
->objects();
foreach ($describe as $object) {
if ($prefix == $object['keyPrefix']) {
return $object['name'];
}
}
return FALSE;
}