Menu

## Object_Sync_Sf_Mapping
in package

class-object-sync-sf-mapping.php : 14

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 : array<string|int, mixed>
  Data in Salesforce that is stored as an array
$date_types_from_salesforce : array<string|int, mixed>
  Data in Salesforce that is stored as a date
$debug : bool
  Option value for whether the plugin is in debug mode
$direction_salesforce : array<string|int, mixed>
  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 : array<string|int, mixed>
  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 : array<string|int, mixed>
  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 : array<string|int, mixed>
  Which events are run by Salesforce
$salesforce_events_v1 : array<string|int, mixed>
  Deprecated hex event values.
$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_off_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_sf_create : string
  Bitmap value for when sync is is on for Salesforce create events
$sync_sf_create_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_sf_delete : string
  Bitmap value for when sync is is on for Salesforce delete events
$sync_sf_delete_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_sf_update : string
  Bitmap value for when sync is is on for Salesforce update events
$sync_sf_update_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_wordpress_create : string
  Bitmap value for when sync is is on for WordPress create events
$sync_wordpress_create_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_wordpress_delete : string
  Bitmap value for when sync is is on for WordPress delete events
$sync_wordpress_delete_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$sync_wordpress_update : string
  Bitmap value for when sync is is on for WordPress update events
$sync_wordpress_update_v1 : int
  Deprecated hex parameter which defines when syncing should occur on each field map.
$version : string
  Current version of the plugin
$wordpress_events : array<string|int, mixed>
  Which events are run by WordPress
$wordpress_events_v1 : array<string|int, mixed>
  Deprecated hex event values.
$wpdb : object
  Global object of `$wpdb`, the WordPress database
__construct() : mixed
  Constructor for mapping class
add_actions() : mixed
  Run init actions.
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
init() : mixed
  Initialize. things that have to run after init.
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

#### $active_fieldmap_conditions

class-object-sync-sf-mapping.php : 84

The active status values for fieldmaps

`public string $active_fieldmap_conditions`

#### $array_delimiter

class-object-sync-sf-mapping.php : 196

Delimiter for arrays coming from Salesforce

`public string $array_delimiter`

#### $array_types_from_salesforce

class-object-sync-sf-mapping.php : 203

Data in Salesforce that is stored as an array

`public array<string|int, mixed> $array_types_from_salesforce`

#### $date_types_from_salesforce

class-object-sync-sf-mapping.php : 210

Data in Salesforce that is stored as a date

`public array<string|int, mixed> $date_types_from_salesforce`

#### $debug

class-object-sync-sf-mapping.php : 245

Option value for whether the plugin is in debug mode

`public bool $debug`

#### $direction_salesforce

class-object-sync-sf-mapping.php : 182

Salesforce directions, including sync

`public array<string|int, mixed> $direction_salesforce`

#### $direction_sf_wordpress

class-object-sync-sf-mapping.php : 161

The direction from Salesforce to WordPress

`public string $direction_sf_wordpress`

#### $direction_sync

class-object-sync-sf-mapping.php : 168

The direction to sync both ways

`public string $direction_sync`

#### $direction_wordpress

class-object-sync-sf-mapping.php : 175

WordPress directions, including sync

`public array<string|int, mixed> $direction_wordpress`

#### $direction_wordpress_sf

class-object-sync-sf-mapping.php : 154

The direction from WordPress to Salesforce

`public string $direction_wordpress_sf`

#### $fieldmap_statuses

class-object-sync-sf-mapping.php : 77

Possible status values for fieldmaps

`public array<string|int, mixed> $fieldmap_statuses`

#### $fieldmap_table

class-object-sync-sf-mapping.php : 63

The database table for fieldmaps

`public string $fieldmap_table`

#### $file

class-object-sync-sf-mapping.php : 28

The main plugin file

`public string $file`

#### $int_types_from_salesforce

class-object-sync-sf-mapping.php : 217

Data in Salesforce that is stored as an integer

`public array<string|int, mixed> $int_types_from_salesforce`

#### $logging

class-object-sync-sf-mapping.php : 56

Object_Sync_Sf_Logging class

`public object $logging`

#### $name_length

class-object-sync-sf-mapping.php : 224

How long can a mapping field be

`public int $name_length`

#### $object_map_table

class-object-sync-sf-mapping.php : 70

The database table for object maps

`public string $object_map_table`

#### $option_prefix

class-object-sync-sf-mapping.php : 49

The plugin's prefix when saving options to the database

`public string $option_prefix`

#### $salesforce_default_record_type

class-object-sync-sf-mapping.php : 189

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

`public string $salesforce_default_record_type`

#### $salesforce_events

class-object-sync-sf-mapping.php : 147

Which events are run by Salesforce

`public array<string|int, mixed> $salesforce_events`

#### $salesforce_events_v1

class-object-sync-sf-mapping.php : 308

Deprecated hex event values.

`public array<string|int, mixed> $salesforce_events_v1`

#### $slug

class-object-sync-sf-mapping.php : 42

The plugin's slug so we can include it when necessary

`public string $slug`

#### $status_error

class-object-sync-sf-mapping.php : 238

Status flag for error

`public int $status_error`

#### $status_success

class-object-sync-sf-mapping.php : 231

Status flag for success

`public int $status_success`

#### $sync_off

class-object-sync-sf-mapping.php : 91

Bitmap value for when sync is off

`public string $sync_off`

#### $sync_off_v1

class-object-sync-sf-mapping.php : 252

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_off_v1`

#### $sync_sf_create

class-object-sync-sf-mapping.php : 119

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

`public string $sync_sf_create`

#### $sync_sf_create_v1

class-object-sync-sf-mapping.php : 280

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_sf_create_v1`

#### $sync_sf_delete

class-object-sync-sf-mapping.php : 133

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

`public string $sync_sf_delete`

#### $sync_sf_delete_v1

class-object-sync-sf-mapping.php : 294

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_sf_delete_v1`

#### $sync_sf_update

class-object-sync-sf-mapping.php : 126

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

`public string $sync_sf_update`

#### $sync_sf_update_v1

class-object-sync-sf-mapping.php : 287

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_sf_update_v1`

#### $sync_wordpress_create

class-object-sync-sf-mapping.php : 98

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

`public string $sync_wordpress_create`

#### $sync_wordpress_create_v1

class-object-sync-sf-mapping.php : 259

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_wordpress_create_v1`

#### $sync_wordpress_delete

class-object-sync-sf-mapping.php : 112

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

`public string $sync_wordpress_delete`

#### $sync_wordpress_delete_v1

class-object-sync-sf-mapping.php : 273

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_wordpress_delete_v1`

#### $sync_wordpress_update

class-object-sync-sf-mapping.php : 105

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

`public string $sync_wordpress_update`

#### $sync_wordpress_update_v1

class-object-sync-sf-mapping.php : 266

Deprecated hex parameter which defines when syncing should occur on each field map.

`public int $sync_wordpress_update_v1`

#### $version

class-object-sync-sf-mapping.php : 21

Current version of the plugin

`public string $version`

#### $wordpress_events

class-object-sync-sf-mapping.php : 140

Which events are run by WordPress

`public array<string|int, mixed> $wordpress_events`

#### $wordpress_events_v1

class-object-sync-sf-mapping.php : 301

Deprecated hex event values.

`public array<string|int, mixed> $wordpress_events_v1`

#### $wpdb

class-object-sync-sf-mapping.php : 35

Global object of `$wpdb`, the WordPress database

`public object $wpdb`

### Methods

#### __construct()

class-object-sync-sf-mapping.php : 313

Constructor for mapping class

`public __construct() : mixed`

##### Return values

mixed —

#### add_actions()

class-object-sync-sf-mapping.php : 400

Run init actions.

`public add_actions() : mixed`

##### Return values

mixed —

#### create_fieldmap()

class-object-sync-sf-mapping.php : 424

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()

class-object-sync-sf-mapping.php : 741

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()

class-object-sync-sf-mapping.php : 723

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()

class-object-sync-sf-mapping.php : 922

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()

class-object-sync-sf-mapping.php : 950

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()

class-object-sync-sf-mapping.php : 801

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()

class-object-sync-sf-mapping.php : 1388

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()

class-object-sync-sf-mapping.php : 1357

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()

class-object-sync-sf-mapping.php : 445

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()

class-object-sync-sf-mapping.php : 528

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()

class-object-sync-sf-mapping.php : 564

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()

class-object-sync-sf-mapping.php : 838

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

#### init()

class-object-sync-sf-mapping.php : 408

Initialize. things that have to run after init.

`public init() : mixed`

##### Return values

mixed —

#### load_all_by_salesforce()

class-object-sync-sf-mapping.php : 1007

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()

class-object-sync-sf-mapping.php : 969

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()

class-object-sync-sf-mapping.php : 986

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()

class-object-sync-sf-mapping.php : 1023

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()

class-object-sync-sf-mapping.php : 577

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()

class-object-sync-sf-mapping.php : 880

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()

class-object-sync-sf-mapping.php : 1295

Format the sync trigger values for storage in the database.

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

##### Parameters

$sync_triggers : array<string|int, mixed>

  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()

class-object-sync-sf-mapping.php : 1271

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()

class-object-sync-sf-mapping.php : 605

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()

class-object-sync-sf-mapping.php : 908

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