You are here

public function SalesforceMappingStorage::loadByProperties in Salesforce Suite 8.4

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

Load entities by their property values.

Parameters

array $values: An associative array where the keys are the property names and the values are the values those properties must have.

Return value

\Drupal\Core\Entity\EntityInterface[] An array of entity objects indexed by their ids.

Overrides EntityStorageBase::loadByProperties

6 calls to SalesforceMappingStorage::loadByProperties()
SalesforceMappingStorage::getMappedSobjectTypes in modules/salesforce_mapping/src/SalesforceMappingStorage.php
Return a unique list of mapped Salesforce object types.
SalesforceMappingStorage::loadByDrupal in modules/salesforce_mapping/src/SalesforceMappingStorage.php
Pass-through for loadMultipleMapping()
SalesforceMappingStorage::loadByEntity in modules/salesforce_mapping/src/SalesforceMappingStorage.php
Pass-through for loadMultipleMapping() including bundle.
SalesforceMappingStorage::loadPullMappings in modules/salesforce_mapping/src/SalesforceMappingStorage.php
Return an array of SalesforceMapping entities who are pull-enabled.
SalesforceMappingStorage::loadPullMappingsByProperties in modules/salesforce_mapping/src/SalesforceMappingStorage.php
Return an array push-enabled mappings by properties.

... See full list

File

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

Class

SalesforceMappingStorage
Class MappedObjectStorage.

Namespace

Drupal\salesforce_mapping

Code

public function loadByProperties(array $values = []) {

  // Build a query to fetch the entity IDs.
  $entity_query = $this
    ->getQuery();
  $this
    ->buildPropertyQuery($entity_query, $values);

  // Sort by the mapping weight to ensure entities/objects are processed in
  // the correct order.
  $entity_query
    ->sort('weight');
  $result = $entity_query
    ->execute();
  return $result ? $this
    ->loadMultiple($result) : [];
}