Object Sync for Salesforce Code Documentation

Object_Sync_Sf_Mapping

Object_Sync_Sf_Mapping class.

Table of Contents

$active_fieldmap_conditions  : string
The active status values for fieldmaps
$array_delimiter  : string
Delimiter for arrays coming from Salesforce
$array_types_from_salesforce  : string
Data in Salesforce that is stored as an array
$date_types_from_salesforce  : string
Data in Salesforce that is stored as a date
$debug  : string
Option value for whether the plugin is in debug mode
$direction_salesforce  : string
Salesforce directions, including sync
$direction_sf_wordpress  : string
The direction from Salesforce to WordPress
$direction_sync  : string
The direction to sync both ways
$direction_wordpress  : string
WordPress directions, including sync
$direction_wordpress_sf  : string
The direction from WordPress to Salesforce
$fieldmap_statuses  : array<string|int, mixed>
Possible status values for fieldmaps
$fieldmap_table  : string
The database table for fieldmaps
$file  : string
The main plugin file
$int_types_from_salesforce  : string
Data in Salesforce that is stored as an integer
$logging  : object
Object_Sync_Sf_Logging class
$name_length  : int
How long can a mapping field be
$object_map_table  : string
The database table for object maps
$option_prefix  : string
The plugin's prefix when saving options to the database
$salesforce_default_record_type  : string
Default record type when using a Salesforce object that has a default or Master record type
$salesforce_events  : string
Which events are run by Salesforce
$slug  : string
The plugin's slug so we can include it when necessary
$status_error  : int
Status flag for error
$status_success  : int
Status flag for success
$sync_off  : string
Bitmap value for when sync is off
$sync_sf_create  : string
Bitmap value for when sync is is on for Salesforce create events
$sync_sf_delete  : string
Bitmap value for when sync is is on for Salesforce delete events
$sync_sf_update  : string
Bitmap value for when sync is is on for Salesforce update events
$sync_wordpress_create  : string
Bitmap value for when sync is is on for WordPress create events
$sync_wordpress_delete  : string
Bitmap value for when sync is is on for WordPress delete events
$sync_wordpress_update  : string
Bitmap value for when sync is is on for WordPress update events
$version  : string
Current version of the plugin
$wordpress_events  : string
Which events are run by WordPress
$wpdb  : object
Global object of `$wpdb`, the WordPress database
__construct()  : mixed
Constructor for mapping class
create_fieldmap()  : int
Create a fieldmap row between a WordPress and Salesforce object
create_object_map()  : false|int
Create an object map row between a WordPress and Salesforce object
delete_fieldmap()  : bool
Delete a fieldmap row between a WordPress and Salesforce object
delete_object_map()  : bool
Delete an object map row between a WordPress and Salesforce object
generate_temporary_id()  : string
Generate a temporary ID to store while waiting for a push or pull to complete, before the record has been assigned a new ID
get_all_object_maps()  : mixed
Get all object map rows between WordPress and Salesforce objects.
get_failed_object_map()  : array<string|int, mixed>
Check object map table to see if there have been any failed object map create attempts
get_failed_object_maps()  : array<string|int, mixed>
Check object map table to see if there have been any failed object map create attempts
get_fieldmaps()  : array<string|int, mixed>
Get one or more fieldmap rows between a WordPress and Salesforce object
get_mapped_fields()  : array<string|int, mixed>
For a mapping, get the fieldmaps associated with it.
get_mapped_record_types()  : array<string|int, mixed>
Get the mapped record types for a given mapping.
get_object_maps()  : array<string|int, mixed>
Get one or more object map rows between WordPress and Salesforce objects
load_all_by_salesforce()  : array<string|int, mixed>
Returns Salesforce object mappings for a given Salesforce object.
load_all_by_wordpress()  : array<string|int, mixed>
Returns Salesforce object mappings for a given WordPress object.
load_object_maps_by_salesforce_id()  : array<string|int, mixed>
Returns Salesforce object mappings for a given Salesforce object.
map_params()  : array<string|int, mixed>
Map values between WordPress and Salesforce objects.
update_fieldmap()  : bool
Update a fieldmap row between a WordPress and Salesforce object
update_object_map()  : bool
Update an object map row between a WordPress and Salesforce object
maybe_upgrade_sync_triggers()  : array<string|int, mixed>
Format the sync trigger values for storage in the database.
prepare_fieldmap_data()  : array<string|int, mixed>
Prepare field map data for use
setup_fieldmap_data()  : array<string|int, mixed>
Setup fieldmap data Sets up the database entry for mapping the object types between Salesforce and WordPress
setup_object_map_data()  : array<string|int, mixed>
Setup the data for the object map

Properties

$salesforce_default_record_type

Default record type when using a Salesforce object that has a default or Master record type

public string $salesforce_default_record_type

$sync_wordpress_create

Bitmap value for when sync is is on for WordPress create events

public string $sync_wordpress_create

$sync_wordpress_delete

Bitmap value for when sync is is on for WordPress delete events

public string $sync_wordpress_delete

$sync_wordpress_update

Bitmap value for when sync is is on for WordPress update events

public string $sync_wordpress_update

Methods

create_fieldmap()

Create a fieldmap row between a WordPress and Salesforce object

public create_fieldmap([array<string|int, mixed> $posted = array() ][, array<string|int, mixed> $wordpress_fields = array() ][, array<string|int, mixed> $salesforce_fields = array() ]) : int
Parameters
$posted : array<string|int, mixed> = array()

The results of $_POST.

$wordpress_fields : array<string|int, mixed> = array()

The fields for the WordPress side of the mapping.

$salesforce_fields : array<string|int, mixed> = array()

The fields for the Salesforce side of the mapping.

Return values
int

the last inserted ID.

create_object_map()

Create an object map row between a WordPress and Salesforce object

public create_object_map([array<string|int, mixed> $posted = array() ]) : false|int
Parameters
$posted : array<string|int, mixed> = array()

It's $_POST.

Return values
false|int

of field mapping between WordPress and Salesforce objects

delete_fieldmap()

Delete a fieldmap row between a WordPress and Salesforce object

public delete_fieldmap([int $id = '' ]) : bool
Parameters
$id : int = ''

The ID of a field mapping.

Return values
bool

whether it was deleted

delete_object_map()

Delete an object map row between a WordPress and Salesforce object

public delete_object_map([int|array<string|int, mixed> $id = '' ]) : bool
Parameters
$id : int|array<string|int, mixed> = ''

The ID or IDs of the object map row(s).

Return values
bool

whether it was deleted

generate_temporary_id()

Generate a temporary ID to store while waiting for a push or pull to complete, before the record has been assigned a new ID

public generate_temporary_id(string $direction) : string
Parameters
$direction : string

Whether this is part of a push or pull action.

Return values
string

$id is a temporary string that will be replaced if the modification is successful.

get_all_object_maps()

Get all object map rows between WordPress and Salesforce objects.

public get_all_object_maps([array<string|int, mixed> $conditions = array() ][, bool $reset = false ]) : mixed

This replaces previous functionality that would return a single object map if there was only one, rather than a multi-dimensional array.

Parameters
$conditions : array<string|int, mixed> = array()

Limitations on the SQL query for object mapping rows.

$reset : bool = false

Unused parameter.

Return values
mixed

get_failed_object_map()

Check object map table to see if there have been any failed object map create attempts

public get_failed_object_map(int $id) : array<string|int, mixed>
Parameters
$id : int

The ID of a desired mapping.

Return values
array<string|int, mixed>

$error Associative array of single row that failed to finish based on id

get_failed_object_maps()

Check object map table to see if there have been any failed object map create attempts

public get_failed_object_maps() : array<string|int, mixed>
Return values
array<string|int, mixed>

$errors Associative array of rows that failed to finish from either system

get_fieldmaps()

Get one or more fieldmap rows between a WordPress and Salesforce object

public get_fieldmaps([int $id = null ][, array<string|int, mixed> $conditions = array() ][, bool $reset = false ]) : array<string|int, mixed>
Parameters
$id : int = null

The ID of a desired mapping.

$conditions : array<string|int, mixed> = array()

Array of key=>value to match the mapping by.

$reset : bool = false

Unused parameter.

Return values
array<string|int, mixed>

$map a single mapping or $mappings, an array of mappings.

get_mapped_fields()

For a mapping, get the fieldmaps associated with it.

public get_mapped_fields(array<string|int, mixed> $mapping[, array<string|int, mixed> $directions = array() ]) : array<string|int, mixed>
Parameters
$mapping : array<string|int, mixed>

The mapping for which we are getting the fieldmaps.

$directions : array<string|int, mixed> = array()

The direction of the mapping: from WP to SF or vice-versa.

Tags
see
Object_Sync_Sf_Salesforce_Pull::get_pull_query()
Return values
array<string|int, mixed>

of mapped fields

get_mapped_record_types()

Get the mapped record types for a given mapping.

public get_mapped_record_types(array<string|int, mixed> $mapping) : array<string|int, mixed>
Parameters
$mapping : array<string|int, mixed>

A mapping from which we wish to estract the record type.

Return values
array<string|int, mixed>

of mappings. Empty if the mapping's record type is default, else full of the record types.

get_object_maps()

Get one or more object map rows between WordPress and Salesforce objects

public get_object_maps([array<string|int, mixed> $conditions = array() ][, bool $reset = false ]) : array<string|int, mixed>
Parameters
$conditions : array<string|int, mixed> = array()

Limitations on the SQL query for object mapping rows.

$reset : bool = false

Unused parameter.

Tags
deprecated

since 1.8.0

Return values
array<string|int, mixed>

$map or $mappings

load_all_by_salesforce()

Returns Salesforce object mappings for a given Salesforce object.

public load_all_by_salesforce(string $salesforce_id[, bool $reset = false ]) : array<string|int, mixed>
Parameters
$salesforce_id : string

Type of object to load.

$reset : bool = false

Whether or not the cache should be cleared and fetch from current data.

Tags
deprecated

since 2.1.0. Will be removed in 3.0.0.

Return values
array<string|int, mixed>

$maps all the object maps that match the Salesforce Id

load_all_by_wordpress()

Returns Salesforce object mappings for a given WordPress object.

public load_all_by_wordpress(string $object_type, int $object_id[, bool $reset = false ]) : array<string|int, mixed>
Parameters
$object_type : string

Type of object to load.

$object_id : int

Unique identifier of the target object to load.

$reset : bool = false

Whether or not the cache should be cleared and fetch from current data.

Return values
array<string|int, mixed>

of object maps

load_object_maps_by_salesforce_id()

Returns Salesforce object mappings for a given Salesforce object.

public load_object_maps_by_salesforce_id(string $salesforce_id[, array<string|int, mixed> $fieldmap = array() ][, bool $reset = false ]) : array<string|int, mixed>
Parameters
$salesforce_id : string

Type of object to load.

$fieldmap : array<string|int, mixed> = array()

the fieldmap this object map works with.

$reset : bool = false

Whether or not the cache should be cleared and fetch from current data.

Return values
array<string|int, mixed>

$maps all the object maps that match the Salesforce Id

map_params()

Map values between WordPress and Salesforce objects.

public map_params(array<string|int, mixed> $mapping, array<string|int, mixed> $object, array<string|int, mixed> $trigger[, bool $use_soap = false ][, bool $is_new = true ][, string $object_id_field = '' ]) : array<string|int, mixed>
Parameters
$mapping : array<string|int, mixed>

Mapping object.

$object : array<string|int, mixed>

WordPress or Salesforce object data.

$trigger : array<string|int, mixed>

The thing that triggered this mapping.

$use_soap : bool = false

Flag to enforce use of the SOAP API.

$is_new : bool = true

Indicates whether a mapping object for this entity already exists.

$object_id_field : string = ''

optionally pass the object id field name.

Return values
array<string|int, mixed>

Associative array of key value pairs.

update_fieldmap()

Update a fieldmap row between a WordPress and Salesforce object

public update_fieldmap([array<string|int, mixed> $posted = array() ][, array<string|int, mixed> $wordpress_fields = array() ][, array<string|int, mixed> $salesforce_fields = array() ][, int $id = '' ]) : bool
Parameters
$posted : array<string|int, mixed> = array()

It's $_POST.

$wordpress_fields : array<string|int, mixed> = array()

The fields for the WordPress side of the mapping.

$salesforce_fields : array<string|int, mixed> = array()

The fields for the Salesforce side of the mapping.

$id : int = ''

The ID of the mapping.

Return values
bool

whether it was updated

update_object_map()

Update an object map row between a WordPress and Salesforce object

public update_object_map([array<string|int, mixed> $posted = array() ][, array<string|int, mixed> $id = '' ]) : bool
Parameters
$posted : array<string|int, mixed> = array()

It's $_POST.

$id : array<string|int, mixed> = ''

The ID of the object map row.

Return values
bool

whether it was updated

maybe_upgrade_sync_triggers()

Format the sync trigger values for storage in the database.

private maybe_upgrade_sync_triggers([array<string|int, mixed> $sync_triggers = array() ], string $mapping_version[, int $mapping_id = '' ]) : array<string|int, mixed>
Parameters
$sync_triggers : array<string|int, mixed> = array()

Array of sync triggers.

$mapping_version : string

the database version when the fieldmmap was saved.

$mapping_id : int = ''

if the fieldmap already exists, this is the ID.

Return values
array<string|int, mixed>

$sync_triggers possibly updated array of sync triggers.

prepare_fieldmap_data()

Prepare field map data for use

private prepare_fieldmap_data(array<string|int, mixed> $mappings[, string $record_type = '' ]) : array<string|int, mixed>
Parameters
$mappings : array<string|int, mixed>

Array of fieldmaps.

$record_type : string = ''

Optional Salesforce record type to see if it is allowed or not.

Return values
array<string|int, mixed>

$mappings Associative array of field maps ready to use

setup_fieldmap_data()

Setup fieldmap data Sets up the database entry for mapping the object types between Salesforce and WordPress

private setup_fieldmap_data([array<string|int, mixed> $posted = array() ][, array<string|int, mixed> $wordpress_fields = array() ][, array<string|int, mixed> $salesforce_fields = array() ]) : array<string|int, mixed>
Parameters
$posted : array<string|int, mixed> = array()

It's $_POST.

$wordpress_fields : array<string|int, mixed> = array()

The fields for the WordPress side of the mapping.

$salesforce_fields : array<string|int, mixed> = array()

The fields for the Salesforce side of the mapping.

Return values
array<string|int, mixed>

$data the fieldmap's data for the database

setup_object_map_data()

Setup the data for the object map

private setup_object_map_data([array<string|int, mixed> $posted = array() ]) : array<string|int, mixed>
Parameters
$posted : array<string|int, mixed> = array()

It's $_POST.

Return values
array<string|int, mixed>

$data Filtered array with only the keys that are in the object map database table. Strips out things from WordPress form if they're present.

Search results