You are here

public function SalesforceMappingStorage::loadPullMappings in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/src/SalesforceMappingStorage.php \Drupal\salesforce_mapping\SalesforceMappingStorage::loadPullMappings()
  2. 8.3 modules/salesforce_mapping/src/SalesforceMappingStorage.php \Drupal\salesforce_mapping\SalesforceMappingStorage::loadPullMappings()

Return an array of SalesforceMapping entities who are pull-enabled.

Parameters

string $entity_type_id: Optionally filter by entity type id.

Return value

\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface[] The Mappings.

File

modules/salesforce_mapping/src/SalesforceMappingStorage.php, line 136

Class

SalesforceMappingStorage
Class MappedObjectStorage.

Namespace

Drupal\salesforce_mapping

Code

public function loadPullMappings($entity_type_id = NULL) {
  $pull_mappings = [];
  $properties = empty($entity_type_id) ? [] : [
    "drupal_entity_type" => $entity_type_id,
  ];
  $mappings = $this
    ->loadByProperties($properties);
  foreach ($mappings as $key => $mapping) {
    if (!$mapping
      ->doesPull()) {
      continue;
    }
    $pull_mappings[$key] = $mapping;
  }
  if (empty($pull_mappings)) {
    return [];
  }
  return $pull_mappings;
}