public function SalesforceMapping::calculateDependencies in Salesforce Suite 5.0.x
Same name and namespace in other branches
- 8.4 modules/salesforce_mapping/src/Entity/SalesforceMapping.php \Drupal\salesforce_mapping\Entity\SalesforceMapping::calculateDependencies()
- 8.3 modules/salesforce_mapping/src/Entity/SalesforceMapping.php \Drupal\salesforce_mapping\Entity\SalesforceMapping::calculateDependencies()
Calculates dependencies and stores them in the dependency property.
Return value
$this
Overrides ConfigEntityBase::calculateDependencies
See also
\Drupal\Core\Config\Entity\ConfigDependencyManager
File
- modules/
salesforce_mapping/ src/ Entity/ SalesforceMapping.php, line 338
Class
- SalesforceMapping
- Defines a Salesforce Mapping configuration entity class.
Namespace
Drupal\salesforce_mapping\EntityCode
public function calculateDependencies() {
// Include config dependencies on all mapped Drupal fields.
$this->dependencies = array_intersect_key($this->dependencies, [
'enforced' => '',
]);
foreach ($this
->getFieldMappings() as $field) {
// Configuration entities need to depend on the providers of any plugins
// that they store the configuration for. Default calculateDependencies()
// method does not work, because our field_mapping plugins are anonymous,
// indexed by numeric id only.
$this
->calculatePluginDependencies($field);
}
// Add a hard dependency on the mapping entity and bundle.
if ($entity_type = $this
->entityTypeManager()
->getDefinition($this
->getDrupalEntityType())) {
$dependency = $entity_type
->getBundleConfigDependency($this
->getDrupalBundle());
$this
->addDependency($dependency['type'], $dependency['name']);
}
if ($this
->doesPull()) {
$this
->addDependency('module', 'salesforce_pull');
}
if ($this
->doesPush()) {
$this
->addDependency('module', 'salesforce_push');
}
return $this;
}