function salesforce_api_object_to_fieldmap_fields in Salesforce Suite 7.2
Same name and namespace in other branches
- 6.2 salesforce_api/salesforce_api.module \salesforce_api_object_to_fieldmap_fields()
- 7 salesforce_api/salesforce_api.module \salesforce_api_object_to_fieldmap_fields()
Convert Salesforce object fields to fieldmap array for saving
1 call to salesforce_api_object_to_fieldmap_fields()
- salesforce_api_cache_build in salesforce_api/
salesforce_api.module - Recreate the Salesforce object cache.
File
- salesforce_api/
salesforce_api.module, line 1876 - Defines an API that enables modules to interact with the Salesforce server.
Code
function salesforce_api_object_to_fieldmap_fields($object) {
$fieldmap_object = array(
'label' => $object->label,
'fields' => array(),
);
if (!empty($object->fields) && is_array($object->fields)) {
foreach ($object->fields as $field) {
$properties = array(
'name',
'label',
'type',
'length',
'soapType',
);
$booleans = array(
'createable',
'defaultedOnCreate',
'deprecatedAndHidden',
'idLookup',
'nillable',
'restrictedPicklist',
'unique',
'updateable',
);
$source = get_object_vars($field);
$sf_definition = array_intersect_key($source, array_flip($properties));
foreach ($booleans as $bool) {
@($sf_definition['sf_type'] |= (int) $source[$bool] * constant('SALESFORCE_FIELD_' . strtoupper($bool)));
}
$fieldmap_object['fields'][$field->name] = array(
'name' => $sf_definition['name'],
'label' => $sf_definition['label'],
'type' => $sf_definition['sf_type'],
'salesforce' => $sf_definition,
);
}
}
return $fieldmap_object;
}