You are here

public function PushParams::__construct in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_mapping/src/PushParams.php \Drupal\salesforce_mapping\PushParams::__construct()
  2. 5.0.x modules/salesforce_mapping/src/PushParams.php \Drupal\salesforce_mapping\PushParams::__construct()

Given a Drupal entity, return an array of Salesforce key-value pairs.

Parameters

\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: Salesforce Mapping.

\Drupal\Core\Entity\EntityInterface $entity: Drupal entity.

array $params: Initial params values (optional).

File

modules/salesforce_mapping/src/PushParams.php, line 46

Class

PushParams
Wrapper for the array of values which will be pushed to Salesforce.

Namespace

Drupal\salesforce_mapping

Code

public function __construct(SalesforceMappingInterface $mapping, EntityInterface $entity, array $params = []) {
  $this->mapping = $mapping;
  $this->drupalEntity = $entity;
  $this->params = $params;
  foreach ($mapping
    ->getFieldMappings() as $field_plugin) {

    // Skip fields that aren't being pushed to Salesforce.
    if (!$field_plugin
      ->push()) {
      continue;
    }
    $this->params[$field_plugin
      ->config('salesforce_field')] = $field_plugin
      ->pushValue($entity, $mapping);
  }
}