public function MappedObjectStorage::loadByEntityAndMapping in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 modules/salesforce_mapping/src/MappedObjectStorage.php \Drupal\salesforce_mapping\MappedObjectStorage::loadByEntityAndMapping()
- 8.3 modules/salesforce_mapping/src/MappedObjectStorage.php \Drupal\salesforce_mapping\MappedObjectStorage::loadByEntityAndMapping()
Load a single MappedObject by Drupal Entity and Mapping.
Parameters
\Drupal\Core\Entity\EntityInterface $entity: Drupal entity.
\Drupal\salesforce_mapping\Entity\SalesforceMappingInterface $mapping: Salesforce Mapping.
Return value
\Drupal\salesforce_mapping\Entity\MappedObjectInterface|null The matching Mapped Object, or null if none are found.
See also
loadByProperties()
File
- modules/
salesforce_mapping/ src/ MappedObjectStorage.php, line 70
Class
- MappedObjectStorage
- Class MappedObjectStorage.
Namespace
Drupal\salesforce_mappingCode
public function loadByEntityAndMapping(EntityInterface $entity, SalesforceMappingInterface $mapping) {
$result = $this
->loadByProperties([
'drupal_entity__target_type' => $entity
->getEntityTypeId(),
'drupal_entity__target_id' => $entity
->id(),
'salesforce_mapping' => $mapping
->id(),
]);
return empty($result) ? NULL : reset($result);
}