You are here

function salesforce_api_id_load in Salesforce Suite 7

Same name and namespace in other branches
  1. 5.2 salesforce_api/salesforce_api.module \salesforce_api_id_load()
  2. 6.2 salesforce_api/salesforce_api.module \salesforce_api_id_load()
  3. 7.2 salesforce_api/salesforce_api.module \salesforce_api_id_load()

Loads the mapping data given identifying information.

Parameters

string $entity: The entity type of the Drupal object you are requesting data for; e.g. node or user.

string $bundle: The bundle the Drupal object belongs to

mixed $id_or_ids: The associated unique ID or IDs used to identify the object in Drupal.

Return value

The fetched query result.

4 calls to salesforce_api_id_load()
sf_entity_entity_load in sf_entity/sf_entity.module
Implements hook_entity_load().
sf_entity_save in sf_entity/sf_entity.module
_sf_node_export_cck_nodereference in sf_entity/sf_entity.module
_sf_node_export_cck_userreference in sf_entity/sf_entity.module

File

salesforce_api/salesforce_api.module, line 767
Defines an API that enables modules to interact with the Salesforce server.

Code

function salesforce_api_id_load($entity, $bundle, $id_or_ids, $key = 'fieldmap') {

  // Query the main ID table for the associated data.
  $op = is_array($id_or_ids) ? 'IN' : '=';
  $query = db_select('salesforce_object_map', 's')
    ->fields('s', array(
    'fieldmap',
    'sfid',
    'oid',
  ))
    ->condition('drupal_entity', $entity)
    ->condition('oid', $id_or_ids, $op);
  if ($bundle) {
    $query
      ->condition('drupal_bundle', $bundle);
  }
  return $query
    ->execute()
    ->fetchAllAssoc($key, PDO::FETCH_ASSOC);
}