You are here

class SalesforceMapping in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/src/Entity/SalesforceMapping.php \Drupal\salesforce_mapping\Entity\SalesforceMapping
  2. 8.3 modules/salesforce_mapping/src/Entity/SalesforceMapping.php \Drupal\salesforce_mapping\Entity\SalesforceMapping

Defines a Salesforce Mapping configuration entity class.

Plugin annotation


@ConfigEntityType(
  id = "salesforce_mapping",
  label = @Translation("Salesforce Mapping"),
  module = "salesforce_mapping",
  handlers = {
    "storage" = "Drupal\salesforce_mapping\SalesforceMappingStorage",
    "view_builder" = "Drupal\Core\Entity\EntityViewBuilder",
    "access" = "Drupal\salesforce_mapping\SalesforceMappingAccessController",
  },
  admin_permission = "administer salesforce mapping",
  entity_keys = {
    "id" = "id",
    "label" = "label",
    "weight" = "weight",
  },
  config_export = {
   "id",
   "label",
   "weight",
   "type",
   "key",
   "async",
   "push_standalone",
   "pull_standalone",
   "pull_trigger_date",
   "pull_where_clause",
   "sync_triggers",
   "salesforce_object_type",
   "drupal_entity_type",
   "drupal_bundle",
   "field_mappings",
   "push_limit",
   "push_retries",
   "push_frequency",
   "pull_frequency",
   "always_upsert"
  },
  lookup_keys = {
    "drupal_entity_type",
    "drupal_bundle",
    "salesforce_object_type"
  }
)

Hierarchy

Expanded class hierarchy of SalesforceMapping

6 files declare their use of SalesforceMapping
PullQueueTest.php in modules/salesforce_pull/tests/src/Functional/PullQueueTest.php
PushParamsTest.php in modules/salesforce_mapping/tests/src/Functional/PushParamsTest.php
PushQueueTest.php in modules/salesforce_push/tests/src/Functional/PushQueueTest.php
SalesforceMappingStorageTest.php in modules/salesforce_mapping/tests/src/Unit/SalesforceMappingStorageTest.php
SalesforceMappingTest.php in modules/salesforce_mapping/tests/src/Unit/SalesforceMappingTest.php

... See full list

File

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

Namespace

Drupal\salesforce_mapping\Entity
View source
class SalesforceMapping extends ConfigEntityBase implements SalesforceMappingInterface {
  use StringTranslationTrait;

  /**
   * Only one bundle type for now.
   *
   * @var string
   */
  protected $type = 'salesforce_mapping';

  /**
   * ID (machine name) of the Mapping.
   *
   * @var string
   *
   * @note numeric id was removed
   */
  protected $id;

  /**
   * Label of the Mapping.
   *
   * @var string
   */
  protected $label;

  /**
   * The UUID for this entity.
   *
   * @var string
   */
  protected $uuid;

  /**
   * A default weight for the mapping.
   *
   * @var int
   */
  protected $weight = 0;

  /**
   * Whether to push asychronous.
   *
   *   - If true, disable real-time push.
   *   - If false (default), attempt real-time push and enqueue failures for
   *     async push.
   *
   * Note this is different behavior compared to D7.
   *
   * @var bool
   */
  protected $async = FALSE;

  /**
   * Whether a standalone push endpoint is enabled for this mapping.
   *
   * @var bool
   */
  protected $push_standalone = FALSE;

  /**
   * Whether a standalone push endpoint is enabled for this mapping.
   *
   * @var bool
   */
  protected $pull_standalone = FALSE;

  /**
   * The Salesforce field to use for determining whether or not to pull.
   *
   * @var string
   */
  protected $pull_trigger_date = 'LastModifiedDate';

  /**
   * Additional "where" logic to append to pull-polling query.
   *
   * @var string
   */
  protected $pull_where_clause = '';

  /**
   * The drupal entity type to which this mapping points.
   *
   * @var string
   */
  protected $drupal_entity_type;

  /**
   * The drupal entity bundle to which this mapping points.
   *
   * @var string
   */
  protected $drupal_bundle;

  /**
   * The salesforce object type to which this mapping points.
   *
   * @var string
   */
  protected $salesforce_object_type;

  /**
   * Salesforce field name for upsert key, if set. Otherwise FALSE.
   *
   * @var string
   */
  protected $key;

  /**
   * If TRUE, always use "upsert" to push data to Salesforce.
   *
   * Otherwise use "upsert" only if upsert key is set and SFID is not available.
   *
   * @var bool
   */
  protected $always_upsert;

  /**
   * Mapped field plugins.
   *
   * @var \Drupal\salesforce_mapping\SalesforceMappingFieldPluginInterface[]
   */
  protected $field_mappings = [];

  /**
   * Active sync triggers.
   *
   * @var array
   */
  protected $sync_triggers = [];

  /**
   * Stateful push data for this mapping.
   *
   * @var array
   */
  protected $push_info;

  /**
   * Statefull pull data for this mapping.
   *
   * @var array
   */
  protected $pull_info;

  /**
   * How often (in seconds) to push with this mapping.
   *
   * @var int
   */
  protected $push_frequency = 0;

  /**
   * Maxmimum number of records to push during a batch.
   *
   * @var int
   */
  protected $push_limit = 0;

  /**
   * Maximum number of attempts to push a record before it's considered failed.
   *
   * @var string
   */
  protected $push_retries = 3;

  /**
   * How often (in seconds) to pull with this mapping.
   *
   * @var int
   */
  protected $pull_frequency = 0;

  /**
   * {@inheritdoc}
   */
  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;
    }
  }

  /**
   * {@inheritdoc}
   */
  public function __get($key) {
    return $this->{$key};
  }

  /**
   * {@inheritdoc}
   */
  public function getPluginCollections() {
    if (empty($this->field_mappings)) {
      return [];
    }
    return [
      'field_mappings' => new DefaultLazyPluginCollection($this
        ->fieldManager(), $this->field_mappings),
    ];
  }

  /**
   * {@inheritdoc}
   */
  public function toArray() {

    // Schema API complains during save() if field_mappings' mapping property
    // exists as a reference to the parent mapping. It's redundant anyway, so
    // we can delete it safely.
    // @TODO there's probably a way to do this with schema.yml, but I can't find it.
    $entity_array = parent::toArray();
    foreach ($entity_array['field_mappings'] as $i => &$value) {
      unset($value['mapping']);
    }
    return $entity_array;
  }

  /**
   * {@inheritdoc}
   */
  public function save() {
    $this->updated = $this
      ->getRequestTime();
    if (isset($this->is_new) && $this->is_new) {
      $this->created = $this
        ->getRequestTime();
    }
    return parent::save();
  }

  /**
   * Testable func to return the request time server variable.
   *
   * @return int
   *   The request time.
   */
  protected function getRequestTime() {
    return \Drupal::time()
      ->getRequestTime();
  }

  /**
   * {@inheritdoc}
   */
  public function postSave(EntityStorageInterface $storage, $update = TRUE) {

    // Update shared pull values across other mappings to same object type.
    $pull_mappings = $storage
      ->loadByProperties([
      'salesforce_object_type' => $this->salesforce_object_type,
    ]);
    unset($pull_mappings[$this
      ->id()]);
    foreach ($pull_mappings as $mapping) {
      if ($this->pull_frequency != $mapping->pull_frequency) {
        $mapping->pull_frequency = $this->pull_frequency;
        $mapping
          ->save();
      }
    }
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  public function onDependencyRemoval(array $dependencies) {
    parent::onDependencyRemoval($dependencies);

    // If the mapped entity type is being removed, we'll delete this mapping.
    $entity_type = $this
      ->entityTypeManager()
      ->getDefinition($this
      ->getDrupalEntityType());
    $dependency = $entity_type
      ->getBundleConfigDependency($this
      ->getDrupalBundle());
    if (!empty($dependencies[$dependency['type']][$dependency['name']])) {
      return FALSE;
    }

    // Otherwise, ask each field mapping plugin if wants to remove itself.
    return $this
      ->removePluginDependencies($dependencies);
  }

  /**
   * Delegate dependency removal events to field mappings plugins.
   *
   * @param array $dependencies
   *   Dependencies.
   */
  public function removePluginDependencies(array $dependencies) {
    $changed = FALSE;
    foreach ($this
      ->getFieldMappings() as $i => $field) {
      if ($field
        ->checkFieldMappingDependency($dependencies)) {
        $changed = TRUE;

        // If a plugin is dependent on the configuration being deleted, remove
        // the field mapping.
        unset($this->field_mappings[$i]);
      }
    }
    return $changed;
  }

  /**
   * {@inheritdoc}
   */
  public function getPullFields() {

    // @TODO This should probably be delegated to a field plugin bag?
    $fields = [];
    foreach ($this
      ->getFieldMappings() as $i => $field_plugin) {

      // Skip fields that aren't being pulled from Salesforce.
      if (!$field_plugin
        ->pull()) {
        continue;
      }
      $fields[$i] = $field_plugin;
    }
    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getPullFieldsArray() {
    return array_column($this->field_mappings, 'salesforce_field', 'salesforce_field');
  }

  /**
   * {@inheritdoc}
   */
  public function getKeyField() {
    return $this->key ? $this->key : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function hasKey() {
    return $this->key ? TRUE : FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getKeyValue(EntityInterface $entity) {
    if (!$this
      ->hasKey()) {
      throw new \Exception('No key defined for this mapping.');
    }

    // @TODO #fieldMappingField
    foreach ($this
      ->getFieldMappings() as $i => $field_plugin) {
      if ($field_plugin
        ->get('salesforce_field') == $this
        ->getKeyField()) {
        return $field_plugin
          ->value($entity, $this);
      }
    }
    throw new \Exception($this
      ->t('Key %key not found for this mapping.', [
      '%key' => $this
        ->getKeyField(),
    ]));
  }

  /**
   * {@inheritdoc}
   */
  public function getSalesforceObjectType() {
    return $this->salesforce_object_type;
  }

  /**
   * {@inheritdoc}
   */
  public function getDrupalEntityType() {
    return $this->drupal_entity_type;
  }

  /**
   * {@inheritdoc}
   */
  public function getDrupalBundle() {
    return $this->drupal_bundle;
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldMappings() {

    // @TODO #fieldMappingField
    $fields = [];
    foreach ($this->field_mappings as $i => $field) {
      $fields[$i] = $this
        ->fieldManager()
        ->createInstance($field['drupal_field_type'], $field + [
        'mapping' => $this,
      ]);
    }
    return $fields;
  }

  /**
   * {@inheritdoc}
   */
  public function getFieldMapping(array $field) {
    return $this
      ->fieldManager()
      ->createInstance($field['drupal_field_type'], $field['config'] + [
      'mapping' => $this,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function getPullTriggerDate() {
    return $this->pull_trigger_date;
  }

  /**
   * {@inheritdoc}
   */
  public function doesPushStandalone() {
    return $this->push_standalone;
  }

  /**
   * {@inheritdoc}
   */
  public function doesPullStandalone() {
    return $this->pull_standalone;
  }

  /**
   * {@inheritdoc}
   */
  public function doesPush() {
    return $this
      ->checkTriggers([
      MappingConstants::SALESFORCE_MAPPING_SYNC_DRUPAL_CREATE,
      MappingConstants::SALESFORCE_MAPPING_SYNC_DRUPAL_UPDATE,
      MappingConstants::SALESFORCE_MAPPING_SYNC_DRUPAL_DELETE,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function doesPull() {
    return $this
      ->checkTriggers([
      MappingConstants::SALESFORCE_MAPPING_SYNC_SF_CREATE,
      MappingConstants::SALESFORCE_MAPPING_SYNC_SF_UPDATE,
      MappingConstants::SALESFORCE_MAPPING_SYNC_SF_DELETE,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function checkTriggers(array $triggers) {
    foreach ($triggers as $trigger) {
      if (!empty($this->sync_triggers[$trigger])) {
        return TRUE;
      }
    }
    return FALSE;
  }

  /**
   * Returns the name of this configuration object.
   *
   * @return string
   *   The name of the configuration object.
   */
  public function getName() {
    return $this->name;
  }

  /**
   * {@inheritdoc}
   */
  public function getLastDeleteTime() {
    return $this->pull_info['last_delete_timestamp'] ?? NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function setLastDeleteTime($time) {
    return $this
      ->setPullInfo('last_delete_timestamp', $time);
  }

  /**
   * {@inheritdoc}
   */
  public function getLastPullTime() {
    return $this->pull_info['last_pull_timestamp'] ?? NULL;
  }

  /**
   * {@inheritdoc}
   */
  public function setLastPullTime($time) {
    return $this
      ->setPullInfo('last_pull_timestamp', $time);
  }

  /**
   * Setter for pull info.
   *
   * @param string $key
   *   The config id to set.
   * @param mixed $value
   *   The value.
   *
   * @return $this
   */
  protected function setPullInfo($key, $value) {
    $this->pull_info[$key] = $value;
    $pull_info = $this
      ->state()
      ->get('salesforce.mapping_pull_info');
    $pull_info[$this
      ->id()] = $this->pull_info;
    $this
      ->state()
      ->set('salesforce.mapping_pull_info', $pull_info);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getNextPullTime() {
    return $this->pull_info['last_pull_timestamp'] + $this->pull_frequency;
  }

  /**
   * {@inheritdoc}
   */
  public function getLastPushTime() {
    return $this->push_info['last_timestamp'];
  }

  /**
   * {@inheritdoc}
   */
  public function setLastPushTime($time) {
    return $this
      ->setPushInfo('last_timestamp', $time);
  }

  /**
   * Setter for pull info.
   *
   * @param string $key
   *   The config id to set.
   * @param mixed $value
   *   The value.
   *
   * @return $this
   */
  protected function setPushInfo($key, $value) {
    $this->push_info[$key] = $value;
    $push_info = $this
      ->state()
      ->get('salesforce.mapping_push_info');
    $push_info[$this
      ->id()] = $this->push_info;
    $this
      ->state()
      ->set('salesforce.mapping_push_info', $push_info);
    return $this;
  }

  /**
   * {@inheritdoc}
   */
  public function getNextPushTime() {
    return $this->push_info['last_timestamp'] + $this->push_frequency;
  }

  /**
   * {@inheritdoc}
   */
  public function getPullQuery(array $mapped_fields = [], $start = 0, $stop = 0) {
    if (!$this
      ->doesPull()) {
      throw new Exception('Mapping does not pull.');
    }
    $object_type = $this
      ->getSalesforceObjectType();
    $soql = new SelectQuery($object_type);

    // Convert field mappings to SOQL.
    if (empty($mapped_fields)) {
      $mapped_fields = $this
        ->getPullFieldsArray();
    }
    $soql->fields = $mapped_fields;
    $soql->fields[] = 'Id';
    $soql->fields[] = $this
      ->getPullTriggerDate();
    $start = $start > 0 ? $start : $this
      ->getLastPullTime();

    // If no lastupdate and no start window provided, get all records.
    if ($start) {
      $start = gmdate('Y-m-d\\TH:i:s\\Z', $start);
      $soql
        ->addCondition($this
        ->getPullTriggerDate(), $start, '>');
    }
    if ($stop) {
      $stop = gmdate('Y-m-d\\TH:i:s\\Z', $stop);
      $soql
        ->addCondition($this
        ->getPullTriggerDate(), $stop, '<');
    }
    if (!empty($this->pull_where_clause)) {
      $soql->conditions[] = [
        $this->pull_where_clause,
      ];
    }
    $soql->order[$this
      ->getPullTriggerDate()] = 'ASC';
    return $soql;
  }

  /**
   * {@inheritdoc}
   */
  public function alwaysUpsert() {
    return $this
      ->hasKey() && !empty($this->always_upsert);
  }

  /**
   * Salesforce Mapping Field Manager service.
   *
   * @return \Drupal\salesforce_mapping\SalesforceMappingFieldPluginManager
   *   The plugin.manager.salesforce_mapping_field service.
   */
  protected function fieldManager() {
    return \Drupal::service('plugin.manager.salesforce_mapping_field');
  }

  /**
   * Salesforce API client service.
   *
   * @return \Drupal\salesforce\Rest\RestClient
   *   The salesforce.client service.
   */
  protected function client() {
    return \Drupal::service('salesforce.client');
  }

  /**
   * State service.
   *
   * @return \Drupal\Core\State\StateInterface
   *   The state service.
   */
  protected function state() {
    return \Drupal::state();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheableDependencyTrait::$cacheContexts protected property Cache contexts.
CacheableDependencyTrait::$cacheMaxAge protected property Cache max-age.
CacheableDependencyTrait::$cacheTags protected property Cache tags.
CacheableDependencyTrait::setCacheability protected function Sets cacheability; useful for value object constructors.
ConfigEntityBase::$isUninstalling private property Whether the config is being deleted by the uninstall process.
ConfigEntityBase::$langcode protected property The language code of the entity's default language.
ConfigEntityBase::$originalId protected property The original ID of the configuration entity.
ConfigEntityBase::$status protected property The enabled/disabled status of the configuration entity. 4
ConfigEntityBase::$third_party_settings protected property Third party entity settings.
ConfigEntityBase::$trustedData protected property Trust supplied data and not use configuration schema on save.
ConfigEntityBase::$_core protected property
ConfigEntityBase::addDependency protected function Overrides \Drupal\Core\Entity\DependencyTrait:addDependency().
ConfigEntityBase::createDuplicate public function Creates a duplicate of the entity. Overrides EntityBase::createDuplicate 1
ConfigEntityBase::disable public function Disables the configuration entity. Overrides ConfigEntityInterface::disable 1
ConfigEntityBase::enable public function Enables the configuration entity. Overrides ConfigEntityInterface::enable
ConfigEntityBase::get public function Returns the value of a property. Overrides ConfigEntityInterface::get
ConfigEntityBase::getCacheTagsToInvalidate public function Returns the cache tags that should be used to invalidate caches. Overrides EntityBase::getCacheTagsToInvalidate 1
ConfigEntityBase::getConfigDependencyName public function Gets the configuration dependency name. Overrides EntityBase::getConfigDependencyName
ConfigEntityBase::getConfigManager protected static function Gets the configuration manager.
ConfigEntityBase::getConfigTarget public function Gets the configuration target identifier for the entity. Overrides EntityBase::getConfigTarget
ConfigEntityBase::getDependencies public function Gets the configuration dependencies. Overrides ConfigEntityInterface::getDependencies
ConfigEntityBase::getOriginalId public function Gets the original ID. Overrides EntityBase::getOriginalId
ConfigEntityBase::getThirdPartyProviders public function Gets the list of third parties that store information. Overrides ThirdPartySettingsInterface::getThirdPartyProviders
ConfigEntityBase::getThirdPartySetting public function Gets the value of a third-party setting. Overrides ThirdPartySettingsInterface::getThirdPartySetting
ConfigEntityBase::getThirdPartySettings public function Gets all third-party settings of a given module. Overrides ThirdPartySettingsInterface::getThirdPartySettings
ConfigEntityBase::getTypedConfig protected function Gets the typed config manager.
ConfigEntityBase::hasTrustedData public function Gets whether on not the data is trusted. Overrides ConfigEntityInterface::hasTrustedData
ConfigEntityBase::invalidateTagsOnDelete protected static function Override to never invalidate the individual entities' cache tags; the config system already invalidates them. Overrides EntityBase::invalidateTagsOnDelete
ConfigEntityBase::invalidateTagsOnSave protected function Override to never invalidate the entity's cache tag; the config system already invalidates it. Overrides EntityBase::invalidateTagsOnSave
ConfigEntityBase::isInstallable public function Checks whether this entity is installable. Overrides ConfigEntityInterface::isInstallable 2
ConfigEntityBase::isNew public function Overrides Entity::isNew(). Overrides EntityBase::isNew
ConfigEntityBase::isUninstalling public function Returns whether this entity is being changed during the uninstall process. Overrides ConfigEntityInterface::isUninstalling
ConfigEntityBase::preDelete public static function Acts on entities before they are deleted and before hooks are invoked. Overrides EntityBase::preDelete 8
ConfigEntityBase::preSave public function Acts on an entity before the presave hook is invoked. Overrides EntityBase::preSave 13
ConfigEntityBase::set public function Sets the value of a property. Overrides ConfigEntityInterface::set
ConfigEntityBase::setOriginalId public function Sets the original ID. Overrides EntityBase::setOriginalId
ConfigEntityBase::setStatus public function Sets the status of the configuration entity. Overrides ConfigEntityInterface::setStatus
ConfigEntityBase::setThirdPartySetting public function Sets the value of a third-party setting. Overrides ThirdPartySettingsInterface::setThirdPartySetting
ConfigEntityBase::setUninstalling public function
ConfigEntityBase::sort public static function Helper callback for uasort() to sort configuration entities by weight and label. 6
ConfigEntityBase::status public function Returns whether the configuration entity is enabled. Overrides ConfigEntityInterface::status 4
ConfigEntityBase::toUrl public function Gets the URL object for the entity. Overrides EntityBase::toUrl
ConfigEntityBase::trustData public function Sets that the data should be trusted. Overrides ConfigEntityInterface::trustData
ConfigEntityBase::unsetThirdPartySetting public function Unsets a third-party setting. Overrides ThirdPartySettingsInterface::unsetThirdPartySetting
ConfigEntityBase::__sleep public function Overrides EntityBase::__sleep 4
DependencySerializationTrait::$_entityStorages protected property
DependencySerializationTrait::$_serviceIds protected property
DependencySerializationTrait::__sleep public function Aliased as: traitSleep 2
DependencySerializationTrait::__wakeup public function 2
DependencyTrait::$dependencies protected property The object's dependencies.
DependencyTrait::addDependencies protected function Adds multiple dependencies.
DependencyTrait::addDependency protected function Adds a dependency. Aliased as: addDependencyTrait
EntityBase::$enforceIsNew protected property Boolean indicating whether the entity should be forced to be new.
EntityBase::$entityTypeId protected property The entity type.
EntityBase::$typedData protected property A typed data object wrapping this entity.
EntityBase::access public function Checks data value access. Overrides AccessibleInterface::access 1
EntityBase::bundle public function Gets the bundle of the entity. Overrides EntityInterface::bundle 1
EntityBase::create public static function Constructs a new entity object, without permanently saving it. Overrides EntityInterface::create
EntityBase::delete public function Deletes an entity permanently. Overrides EntityInterface::delete 2
EntityBase::enforceIsNew public function Enforces an entity to be new. Overrides EntityInterface::enforceIsNew
EntityBase::entityTypeBundleInfo protected function Gets the entity type bundle info service.
EntityBase::entityTypeManager protected function Gets the entity type manager.
EntityBase::getCacheContexts public function The cache contexts associated with this object. Overrides CacheableDependencyTrait::getCacheContexts
EntityBase::getCacheMaxAge public function The maximum age for which this object may be cached. Overrides CacheableDependencyTrait::getCacheMaxAge
EntityBase::getCacheTags public function The cache tags associated with this object. Overrides CacheableDependencyTrait::getCacheTags
EntityBase::getConfigDependencyKey public function Gets the key that is used to store configuration dependencies. Overrides EntityInterface::getConfigDependencyKey
EntityBase::getEntityType public function Gets the entity type definition. Overrides EntityInterface::getEntityType
EntityBase::getEntityTypeId public function Gets the ID of the type of the entity. Overrides EntityInterface::getEntityTypeId
EntityBase::getListCacheTagsToInvalidate protected function The list cache tags to invalidate for this entity.
EntityBase::getTypedData public function Gets a typed data object for this entity object. Overrides EntityInterface::getTypedData
EntityBase::hasLinkTemplate public function Indicates if a link template exists for a given key. Overrides EntityInterface::hasLinkTemplate
EntityBase::id public function Gets the identifier. Overrides EntityInterface::id 11
EntityBase::label public function Gets the label of the entity. Overrides EntityInterface::label 6
EntityBase::language public function Gets the language of the entity. Overrides EntityInterface::language 1
EntityBase::languageManager protected function Gets the language manager.
EntityBase::linkTemplates protected function Gets an array link templates. 1
EntityBase::load public static function Loads an entity. Overrides EntityInterface::load
EntityBase::loadMultiple public static function Loads one or more entities. Overrides EntityInterface::loadMultiple
EntityBase::postCreate public function Acts on a created entity before hooks are invoked. Overrides EntityInterface::postCreate 4
EntityBase::postDelete public static function Acts on deleted entities before the delete hook is invoked. Overrides EntityInterface::postDelete 18
EntityBase::postLoad public static function Acts on loaded entities. Overrides EntityInterface::postLoad 2
EntityBase::preCreate public static function Changes the values of an entity before it is created. Overrides EntityInterface::preCreate 7
EntityBase::referencedEntities public function Gets a list of entities referenced by this entity. Overrides EntityInterface::referencedEntities 1
EntityBase::toLink public function Generates the HTML for a link to this entity. Overrides EntityInterface::toLink
EntityBase::uriRelationships public function Gets a list of URI relationships supported by this entity. Overrides EntityInterface::uriRelationships
EntityBase::urlRouteParameters protected function Gets an array of placeholders for this entity. 2
EntityBase::uuid public function Gets the entity UUID (Universally Unique Identifier). Overrides EntityInterface::uuid 1
EntityBase::uuidGenerator protected function Gets the UUID generator.
PluginDependencyTrait::calculatePluginDependencies protected function Calculates and adds dependencies of a specific plugin instance. 1
PluginDependencyTrait::getPluginDependencies protected function Calculates and returns dependencies of a specific plugin instance.
PluginDependencyTrait::moduleHandler protected function Wraps the module handler. 1
PluginDependencyTrait::themeHandler protected function Wraps the theme handler. 1
RefinableCacheableDependencyTrait::addCacheableDependency public function 1
RefinableCacheableDependencyTrait::addCacheContexts public function
RefinableCacheableDependencyTrait::addCacheTags public function
RefinableCacheableDependencyTrait::mergeCacheMaxAge public function
SalesforceMapping::$always_upsert protected property If TRUE, always use "upsert" to push data to Salesforce.
SalesforceMapping::$async protected property Whether to push asychronous.
SalesforceMapping::$drupal_bundle protected property The drupal entity bundle to which this mapping points.
SalesforceMapping::$drupal_entity_type protected property The drupal entity type to which this mapping points.
SalesforceMapping::$field_mappings protected property Mapped field plugins.
SalesforceMapping::$id protected property ID (machine name) of the Mapping.
SalesforceMapping::$key protected property Salesforce field name for upsert key, if set. Otherwise FALSE.
SalesforceMapping::$label protected property Label of the Mapping.
SalesforceMapping::$pull_frequency protected property How often (in seconds) to pull with this mapping.
SalesforceMapping::$pull_info protected property Statefull pull data for this mapping.
SalesforceMapping::$pull_standalone protected property Whether a standalone push endpoint is enabled for this mapping.
SalesforceMapping::$pull_trigger_date protected property The Salesforce field to use for determining whether or not to pull.
SalesforceMapping::$pull_where_clause protected property Additional "where" logic to append to pull-polling query.
SalesforceMapping::$push_frequency protected property How often (in seconds) to push with this mapping.
SalesforceMapping::$push_info protected property Stateful push data for this mapping.
SalesforceMapping::$push_limit protected property Maxmimum number of records to push during a batch.
SalesforceMapping::$push_retries protected property Maximum number of attempts to push a record before it's considered failed.
SalesforceMapping::$push_standalone protected property Whether a standalone push endpoint is enabled for this mapping.
SalesforceMapping::$salesforce_object_type protected property The salesforce object type to which this mapping points.
SalesforceMapping::$sync_triggers protected property Active sync triggers.
SalesforceMapping::$type protected property Only one bundle type for now.
SalesforceMapping::$uuid protected property The UUID for this entity. Overrides ConfigEntityBase::$uuid
SalesforceMapping::$weight protected property A default weight for the mapping.
SalesforceMapping::alwaysUpsert public function Return TRUE if this mapping should always use upsert over create or update. Overrides SalesforceMappingInterface::alwaysUpsert
SalesforceMapping::calculateDependencies public function Calculates dependencies and stores them in the dependency property. Overrides ConfigEntityBase::calculateDependencies
SalesforceMapping::checkTriggers public function Checks if mapping has any of the given triggers. Overrides SalesforceMappingInterface::checkTriggers
SalesforceMapping::client protected function Salesforce API client service.
SalesforceMapping::doesPull public function Checks mappings for any pull operation. Overrides SalesforceMappingInterface::doesPull
SalesforceMapping::doesPullStandalone public function Getter for push_standalone property. Overrides SalesforceMappingInterface::doesPullStandalone
SalesforceMapping::doesPush public function Checks mappings for any push operation. Overrides SalesforceMappingInterface::doesPush
SalesforceMapping::doesPushStandalone public function Getter for push_standalone property. Overrides SalesforceMappingInterface::doesPushStandalone
SalesforceMapping::fieldManager protected function Salesforce Mapping Field Manager service.
SalesforceMapping::getDrupalBundle public function Get the Drupal bundle name for this mapping, e.g. "article". Overrides SalesforceMappingInterface::getDrupalBundle
SalesforceMapping::getDrupalEntityType public function Get the Drupal entity type name for this mapping, e.g. "node". Overrides SalesforceMappingInterface::getDrupalEntityType
SalesforceMapping::getFieldMapping public function Given a field config, create an instance of a field mapping. Overrides SalesforceMappingInterface::getFieldMapping
SalesforceMapping::getFieldMappings public function Get all the mapped field plugins for this mapping. Overrides SalesforceMappingInterface::getFieldMappings
SalesforceMapping::getKeyField public function Return name of the Salesforce field which is the upsert key. Overrides SalesforceMappingInterface::getKeyField
SalesforceMapping::getKeyValue public function Given a Drupal entity, get the value to be upserted. Overrides SalesforceMappingInterface::getKeyValue
SalesforceMapping::getLastDeleteTime public function Return the timestamp for the date of most recent delete processing. Overrides SalesforceMappingInterface::getLastDeleteTime
SalesforceMapping::getLastPullTime public function Return the timestamp for the date of most recent pull processing. Overrides SalesforceMappingInterface::getLastPullTime
SalesforceMapping::getLastPushTime public function Returns a timstamp when the push queue was last processed for this mapping. Overrides SalesforceMappingInterface::getLastPushTime
SalesforceMapping::getName public function Returns the name of this configuration object.
SalesforceMapping::getNextPullTime public function Get the timestamp when the next pull should be processed for this mapping. Overrides SalesforceMappingInterface::getNextPullTime
SalesforceMapping::getNextPushTime public function Get the timestamp when the next push should be processed for this mapping. Overrides SalesforceMappingInterface::getNextPushTime
SalesforceMapping::getPluginCollections public function Gets the plugin collections used by this object. Overrides ObjectWithPluginCollectionInterface::getPluginCollections
SalesforceMapping::getPullFields public function Get all the field plugins which are configured to pull from Salesforce. Overrides SalesforceMappingInterface::getPullFields
SalesforceMapping::getPullFieldsArray public function Get a flat array of the field plugins which are configured to pull. Overrides SalesforceMappingInterface::getPullFieldsArray
SalesforceMapping::getPullQuery public function Generate a select query to pull records from Salesforce for this mapping. Overrides SalesforceMappingInterface::getPullQuery
SalesforceMapping::getPullTriggerDate public function The Salesforce date field which determines whether to pull. Overrides SalesforceMappingInterface::getPullTriggerDate
SalesforceMapping::getRequestTime protected function Testable func to return the request time server variable.
SalesforceMapping::getSalesforceObjectType public function Get the Salesforce Object type name for this mapping, e.g. "Contact". Overrides SalesforceMappingInterface::getSalesforceObjectType
SalesforceMapping::hasKey public function Return TRUE if an upsert key is set for this mapping. Overrides SalesforceMappingInterface::hasKey
SalesforceMapping::onDependencyRemoval public function Informs the entity that entities it depends on will be deleted. Overrides ConfigEntityBase::onDependencyRemoval
SalesforceMapping::postSave public function Acts on a saved entity before the insert or update hook is invoked. Overrides EntityBase::postSave
SalesforceMapping::removePluginDependencies public function Delegate dependency removal events to field mappings plugins.
SalesforceMapping::save public function Saves an entity permanently. Overrides ConfigEntityBase::save
SalesforceMapping::setLastDeleteTime public function Set this mapping as having been last processed for deletes at $time. Overrides SalesforceMappingInterface::setLastDeleteTime
SalesforceMapping::setLastPullTime public function Set this mapping as having been last pulled at $time. Overrides SalesforceMappingInterface::setLastPullTime
SalesforceMapping::setLastPushTime public function Set the timestamp when the push queue was last process for this mapping. Overrides SalesforceMappingInterface::setLastPushTime
SalesforceMapping::setPullInfo protected function Setter for pull info.
SalesforceMapping::setPushInfo protected function Setter for pull info.
SalesforceMapping::state protected function State service.
SalesforceMapping::toArray public function Gets an array of all property values. Overrides ConfigEntityBase::toArray
SalesforceMapping::__construct public function Constructs an Entity object. Overrides ConfigEntityBase::__construct
SalesforceMapping::__get public function Magic getter method for mapping properties. Overrides SalesforceMappingInterface::__get
StringTranslationTrait::$stringTranslation protected property The string translation service. 4
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.
SynchronizableEntityTrait::$isSyncing protected property Whether this entity is being created, updated or deleted through a synchronization process.
SynchronizableEntityTrait::isSyncing public function
SynchronizableEntityTrait::setSyncing public function