You are here

public function Salesforce::objects in Salesforce Suite 7.3

Available objects and their metadata for your organization's data.

Parameters

array $conditions: Associative array of filters to apply to the returned objects. Filters are applied after the list is returned from Salesforce.

bool $reset: Whether to reset the cache and retrieve a fresh version from Salesforce.

Return value

array Available objects and metadata.

1 call to Salesforce::objects()
Salesforce::getSobjectType in includes/salesforce.inc
Given a Salesforce ID, return the corresponding SObject name. (Based on keyPrefix from object definition,

File

includes/salesforce.inc, line 493
Objects, properties, and methods to communicate with the Salesforce REST API

Class

Salesforce
Ability to authorize and communicate with the Salesforce REST API.

Code

public function objects($conditions = array(
  'updateable' => TRUE,
), $reset = FALSE) {
  $cache = cache_get('salesforce_objects');

  // Force the recreation of the cache when it is older than 5 minutes.
  if ($cache && REQUEST_TIME < $cache->created + 300 && !$reset) {
    $result = $cache->data;
  }
  else {
    $result = $this
      ->apiCall('sobjects');

    // Allow the cache to clear at any time by not setting an expire time.
    cache_set('salesforce_objects', $result, 'cache', CACHE_TEMPORARY);
  }
  if (!empty($conditions)) {
    foreach ($result['sobjects'] as $key => $object) {
      foreach ($conditions as $condition => $value) {
        if ($object[$condition] != $value) {
          unset($result['sobjects'][$key]);
        }
      }
    }
  }
  return $result['sobjects'];
}