You are here

public function SalesforceMapping::__construct in Salesforce Suite 8.4

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

Constructs an Entity object.

Parameters

array $values: An array of values to set, keyed by property name. If the entity type has bundles, the bundle key has to be specified.

string $entity_type: The type of the entity to create.

Overrides ConfigEntityBase::__construct

File

modules/salesforce_mapping/src/Entity/SalesforceMapping.php, line 239

Class

SalesforceMapping
Defines a Salesforce Mapping configuration entity class.

Namespace

Drupal\salesforce_mapping\Entity

Code

public function __construct(array $values, $entity_type) {
  parent::__construct($values, $entity_type);
  $push_info = $this
    ->state()
    ->get('salesforce.mapping_push_info', []);
  if (empty($push_info[$this
    ->id()])) {
    $push_info[$this
      ->id()] = [
      'last_timestamp' => 0,
    ];
  }
  $this->push_info = $push_info[$this
    ->id()];
  $pull_info = $this
    ->state()
    ->get('salesforce.mapping_pull_info', []);
  if (empty($pull_info[$this
    ->id()])) {
    $pull_info[$this
      ->id()] = [
      'last_pull_timestamp' => 0,
      'last_delete_timestamp' => 0,
    ];
  }
  $this->pull_info = $pull_info[$this
    ->id()];
  foreach ($this->field_mappings as $i => &$field_mapping) {
    $field_mapping['id'] = $i;
    $field_mapping['mapping'] = $this;
  }
}