Object Sync for Salesforce Code Documentation

Object_Sync_Sf_Salesforce_Push

Object_Sync_Sf_Salesforce_Push class.

Table of Contents

$debug  : string
Whether the plugin is in debug mode
$file  : string
The main plugin file
$logging  : object
Object_Sync_Sf_Logging class
$login_credentials  : array<string|int, mixed>
Login credentials for the Salesforce API; comes from wp-config or from the plugin settings
$mappings  : object
Object_Sync_Sf_Mapping class
$option_prefix  : string
The plugin's prefix when saving options to the database
$queue  : object
Object_Sync_Sf_Queue class
$salesforce  : array<string|int, mixed>
Object_Sync_Sf_Salesforce class This contains Salesforce API methods
$schedulable_classes  : array<string|int, mixed>
Array of what classes in the plugin can be scheduled to occur with `wp_cron` events
$schedule_name  : string
The name of the ActionScheduler queue
$slug  : string
The plugin's slug so we can include it when necessary
$sync_transients  : object
Object_Sync_Sf_Sync_Transients class
$version  : string
Current version of the plugin
$wordpress  : object
Object_Sync_Sf_WordPress class
$wpdb  : object
Global object of `$wpdb`, the WordPress database
__construct()  : mixed
Constructor for push class
acf_save()  : mixed
Callback method for saving a post with ACF. If it's a front end save, send the data to post_actions.
add_actions()  : mixed
Create the action hooks based on what object maps exist from the admin settings.
add_attachment()  : mixed
Callback method for adding an attachment
add_comment()  : mixed
Callback method for adding a comment
add_term()  : mixed
Callback method for adding a term
add_user()  : mixed
Callback method for adding a user
delete_attachment()  : mixed
Callback method for deleting an attachment
delete_comment()  : mixed
Callback method for deleting a comment
delete_term()  : mixed
Callback method for deleting a term
delete_user()  : mixed
Callback method for deleting a user
edit_attachment()  : mixed
Callback method for editing an attachment
edit_comment()  : mixed
Callback method for editing a comment
edit_term()  : mixed
Callback method for editing a term
edit_user()  : mixed
Callback method for editing a user
manual_push()  : mixed
Method for ajax hooks to call for pushing manually
post_actions()  : mixed
Callback method for posts of any type This can handle create, update, and delete actions
salesforce_push_sync_rest()  : true
Sync WordPress objects and Salesforce objects using the REST API.
um_add_user()  : mixed
Callback method for adding a user via the Ultimate Member plugin
create_object_map()  : int
Create an object map between a WordPress object and a Salesforce object
is_push_allowed()  : bool
Find out if push is allowed for this record
object_delete()  : mixed
Delete an existing object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.
object_insert()  : mixed
Insert a new object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.
object_update()  : mixed
Update an existing object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.
salesforce_push_object_crud()  : mixed
Push objects to Salesforce.

Properties

$login_credentials

Login credentials for the Salesforce API; comes from wp-config or from the plugin settings

public array<string|int, mixed> $login_credentials

$schedulable_classes

Array of what classes in the plugin can be scheduled to occur with `wp_cron` events

public array<string|int, mixed> $schedulable_classes

Methods

acf_save()

Callback method for saving a post with ACF. If it's a front end save, send the data to post_actions.

public acf_save(int $post_id) : mixed
Parameters
$post_id : int

the ID of the post.

Return values
mixed

add_actions()

Create the action hooks based on what object maps exist from the admin settings.

public add_actions() : mixed

We do not have any actions for blogroll at this time.

Return values
mixed

add_attachment()

Callback method for adding an attachment

public add_attachment(string $post_id) : mixed
Parameters
$post_id : string

the WordPress attachment ID.

Return values
mixed

add_comment()

Callback method for adding a comment

public add_comment(string $comment_id, string $comment_approved[, array<string|int, mixed> $commentdata = array() ]) : mixed
Parameters
$comment_id : string

the WordPress comment ID.

$comment_approved : string

if the comment was approved.

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

the data for the comment.

Return values
mixed

add_term()

Callback method for adding a term

public add_term(string $term_id, string $tt_id, string $taxonomy) : mixed
Parameters
$term_id : string

the term ID.

$tt_id : string

the taxonomy ID.

$taxonomy : string

the taxonomy name.

Return values
mixed

add_user()

Callback method for adding a user

public add_user(string $user_id) : mixed
Parameters
$user_id : string

the WordPress user ID.

Return values
mixed

delete_attachment()

Callback method for deleting an attachment

public delete_attachment(string $post_id) : mixed
Parameters
$post_id : string

the WordPress attachment ID.

Return values
mixed

delete_comment()

Callback method for deleting a comment

public delete_comment(string $comment_id) : mixed
Parameters
$comment_id : string

the WordPress comment ID.

Return values
mixed

delete_term()

Callback method for deleting a term

public delete_term(int $term, int $tt_id, string $taxonomy, object $deleted_term) : mixed
Parameters
$term : int

(id).

$tt_id : int

the term taxonomy ID.

$taxonomy : string

(slug).

$deleted_term : object

the deleted term object.

Return values
mixed

delete_user()

Callback method for deleting a user

public delete_user(string $user_id) : mixed
Parameters
$user_id : string

the WordPress user ID.

Return values
mixed

edit_attachment()

Callback method for editing an attachment

public edit_attachment(string $post_id) : mixed
Parameters
$post_id : string

the WordPress attachment ID.

Return values
mixed

edit_comment()

Callback method for editing a comment

public edit_comment(string $comment_id) : mixed
Parameters
$comment_id : string

the WordPress comment ID.

Return values
mixed

edit_term()

Callback method for editing a term

public edit_term(string $term_id, string $taxonomy) : mixed
Parameters
$term_id : string

the term ID.

$taxonomy : string

the taxonomy name.

Return values
mixed

edit_user()

Callback method for editing a user

public edit_user(string $user_id, object $old_user_data) : mixed
Parameters
$user_id : string

the WordPress user ID.

$old_user_data : object

the previously used user data.

Return values
mixed

manual_push()

Method for ajax hooks to call for pushing manually

public manual_push(string $object_type, int $wordpress_id, string $http_method) : mixed
Parameters
$object_type : string

the WordPress object type.

$wordpress_id : int

the WordPress record ID.

$http_method : string

the HTTP method that was called.

Return values
mixed

post_actions()

Callback method for posts of any type This can handle create, update, and delete actions

public post_actions(string $post_id, object $post) : mixed
Parameters
$post_id : string

the WordPress post ID.

$post : object

the WordPress post object.

Return values
mixed

salesforce_push_sync_rest()

Sync WordPress objects and Salesforce objects using the REST API.

public salesforce_push_sync_rest(string $object_type, array<string|int, mixed>|int $object, array<string|int, mixed> $mapping, int $sf_sync_trigger) : true
Parameters
$object_type : string

Type of WordPress object.

$object : array<string|int, mixed>|int

The WordPress object data or its ID value.

$mapping : array<string|int, mixed>

Salesforce field mapping data array or ID.

$sf_sync_trigger : int

Trigger for this sync.

Return values
true

or exit the method

um_add_user()

Callback method for adding a user via the Ultimate Member plugin

public um_add_user(string $user_id[, array<string|int, mixed> $form_data = array() ]) : mixed
Parameters
$user_id : string

the WordPress user ID.

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

the data that was sent to create the user.

Return values
mixed

create_object_map()

Create an object map between a WordPress object and a Salesforce object

private create_object_map(array<string|int, mixed> $wordpress_object, string $id_field_name, string $salesforce_id, array<string|int, mixed> $field_mapping[, bool $pending = false ]) : int
Parameters
$wordpress_object : array<string|int, mixed>

Array of the WordPress object's data.

$id_field_name : string

How this object names its primary field. ie Id or comment_id or whatever.

$salesforce_id : string

Unique identifier for the Salesforce object.

$field_mapping : array<string|int, mixed>

The row that maps the object types together, including which fields match which other fields.

$pending : bool = false

check if it is a pending action or the full object map has already been created.

Return values
int

$wpdb->insert_id This is the database row for the map object.

is_push_allowed()

Find out if push is allowed for this record

private is_push_allowed(string $object_type, array<string|int, mixed> $object, string $sf_sync_trigger, array<string|int, mixed> $mapping, array<string|int, mixed> $map_sync_triggers) : bool
Parameters
$object_type : string

WordPress object type.

$object : array<string|int, mixed>

Array of the WordPress object's data.

$sf_sync_trigger : string

The current operation's trigger.

$mapping : array<string|int, mixed>

the fieldmap that maps the two object types.

$map_sync_triggers : array<string|int, mixed>

the enabld map triggers.

Return values
bool

$push_allowed Whether all this stuff allows the $api_result to be pushed to Salesforce

object_delete()

Delete an existing object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.

private object_delete(array<string|int, mixed> $object, string $type) : mixed
Parameters
$object : array<string|int, mixed>

the object data to send to WordPress.

$type : string

the WordPress object type.

Return values
mixed

object_insert()

Insert a new object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.

private object_insert(array<string|int, mixed> $object, string $type) : mixed
Parameters
$object : array<string|int, mixed>

the object data to send to WordPress.

$type : string

the WordPress object type.

Return values
mixed

object_update()

Update an existing object This calls the overall push crud method, which controls queuing and sending data to the Salesforce class.

private object_update(array<string|int, mixed> $object, string $type) : mixed
Parameters
$object : array<string|int, mixed>

the object data to send to WordPress.

$type : string

the WordPress object type.

Return values
mixed

salesforce_push_object_crud()

Push objects to Salesforce.

private salesforce_push_object_crud(string $object_type, array<string|int, mixed> $object, int $sf_sync_trigger[, bool $manual = false ]) : mixed

This method decides whether to do the processing immediately or queue it to the schedule class (or skip it based on another plugin's activity)

Parameters
$object_type : string

Type of WordPress object.

$object : array<string|int, mixed>

The WordPress data that needs to be sent to Salesforce.

$sf_sync_trigger : int

The trigger being responded to.

$manual : bool = false

check if we are calling this manually.

Return values
mixed

Search results