You are here

final class SalesforceEvents in Salesforce Suite 5.0.x

Same name and namespace in other branches
  1. 8.4 src/Event/SalesforceEvents.php \Drupal\salesforce\Event\SalesforceEvents
  2. 8.3 src/Event/SalesforceEvents.php \Drupal\salesforce\Event\SalesforceEvents

Defines events for Salesforce.

Hierarchy

Expanded class hierarchy of SalesforceEvents

See also

\Drupal\salesforce\Event\SalesforceEvents

19 files declare their use of SalesforceEvents
DeleteHandler.php in modules/salesforce_pull/src/DeleteHandler.php
MappedObject.php in modules/salesforce_mapping/src/Entity/MappedObject.php
MappedObjectDeleteForm.php in modules/salesforce_mapping_ui/src/Form/MappedObjectDeleteForm.php
MappedObjectForm.php in modules/salesforce_mapping_ui/src/Form/MappedObjectForm.php
PullBase.php in modules/salesforce_pull/src/Plugin/QueueWorker/PullBase.php

... See full list

File

src/Event/SalesforceEvents.php, line 10

Namespace

Drupal\salesforce\Event
View source
final class SalesforceEvents {

  /**
   * Dispatched before enqueueing or triggering an entity delete.
   *
   * Event listeners should call $event->disallowDelete() to prevent delete.
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforceDeleteAllowedEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const DELETE_ALLOWED = 'salesforce.delete_allowed';

  /**
   * Dispatched before enqueueing or triggering a push event.
   *
   * Event listeners should call $event->disallowPush() to prevent push.
   *
   * Previously hook_salesforce_push_mapping_object_alter().
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforcePushAllowedEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const PUSH_ALLOWED = 'salesforce.push_allowed';

  /**
   * Dispatched immediately before processing a push event.
   *
   * Useful for injecting business logic into a MappedObject record, e.g. to
   * change the SFID before pushing to Salesforce.
   *
   * Previously hook_salesforce_push_mapping_object_alter().
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforcePushOpEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const PUSH_MAPPING_OBJECT = 'salesforce.push_mapping_object';

  /**
   * Dispatched after building params to push to Salesforce.
   *
   * Allow modifying params before they're pushed to Salesforce.
   * Previously hook_salesforce_push_params_alter().
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforcePushParamsEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const PUSH_PARAMS = 'salesforce.push_params';

  /**
   * Dispatched after successful push to Salesforce.
   *
   * Previously Hook_salesforce_push_success().
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforcePushParamsEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const PUSH_SUCCESS = 'salesforce.push_success';

  /**
   * Dispatched after failed push to Salesforce.
   *
   * Previously hook_salesforce_push_fail().
   *
   * The event listener method receives a
   * \Drupal\salesforce_mapping\Event\SalesforcePushOpEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const PUSH_FAIL = 'salesforce.push_fail';

  /**
   * Dispatched before querying Salesforce to pull records.
   *
   * Previously hook_salesforce_pull_select_query_alter().
   *
   * Subscribers receive a Drupal\salesforce_mapping\Event\SalesforcePullEvent
   * instance, via which Drupal\salesforce\SelectQuery may be altered before
   * building Salesforce Drupal\salesforce_pull\PullQueueItem items.
   *
   * @Event
   *
   * @var string
   */
  const PULL_QUERY = 'salesforce.pull_query';

  /**
   * Dispatched before mapping entity fields for a pull.
   *
   * Can be used, for example, to alter SF object retrieved from Salesforce or
   * to assign a different Drupal entity.
   *
   * Previously hook_salesforce_pull_mapping_object_alter().
   *
   * Subscribers receive a Drupal\salesforce_mapping\Event\SalesforcePullEvent
   * instance. Listeners should throw an exception to prevent an item from being
   * pulled, per Drupal\Core\Queue\QueueWorkerInterface.
   *
   * @see \Drupal\Core\Queue\QueueWorkerInterface
   *
   * @Event
   *
   * @var string
   */
  const PULL_PREPULL = 'salesforce.pull_prepull';

  /**
   * Dispatched before assigning Drupal entity values during pull.
   *
   * Pull analog to PUSH_PARAMS.
   *
   * Previously hook_salesforce_pull_entity_value_alter().
   *
   * Subscribers receive a Drupal\salesforce_mapping\Event\SalesforcePullEvent
   * instance in order to modify pull field values or entities.
   *
   * @Event
   *
   * @var string
   */
  const PULL_ENTITY_VALUE = 'salesforce.pull_entity_value';

  /**
   * Dispatched immediately prior to saving the pulled Drupal entity.
   *
   * After all fields have been mapped and values assigned, can be used, for
   * example, to override mapping fields or implement data transformations.
   * Final chance for subscribers to prevent creation or alter a Drupal entity
   * during pull. Post-save operations (insert/update) should rely on
   * hook_entity_update or hook_entity_insert().
   *
   * Previously hook_salesforce_pull_entity_presave().
   *
   * Subscribers receive a Drupal\salesforce_mapping\Event\SalesforcePullEvent
   * instance.
   *
   * @Event
   *
   * @var string
   */
  const PULL_PRESAVE = 'salesforce.pull_presave';

  /**
   * Dispatched when Salesforce encounters a loggable, non-fatal error.
   *
   * Subscribers receive a Drupal\salesforce\SalesforceErrorEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const ERROR = 'salesforce.error';

  /**
   * Dispatched when Salesforce encounters a concerning, but non-error event.
   *
   * Subscribers receive a Drupal\salesforce\SalesforceWarningEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const WARNING = 'salesforce.warning';

  /**
   * Dispatched when Salesforce encounters a basic loggable event.
   *
   * Subscribers receive a Drupal\salesforce\SalesforceNoticeEvent instance.
   *
   * @Event
   *
   * @var string
   */
  const NOTICE = 'salesforce.notice';

}

Members

Namesort descending Modifiers Type Description Overrides
SalesforceEvents::DELETE_ALLOWED constant Dispatched before enqueueing or triggering an entity delete.
SalesforceEvents::ERROR constant Dispatched when Salesforce encounters a loggable, non-fatal error.
SalesforceEvents::NOTICE constant Dispatched when Salesforce encounters a basic loggable event.
SalesforceEvents::PULL_ENTITY_VALUE constant Dispatched before assigning Drupal entity values during pull.
SalesforceEvents::PULL_PREPULL constant Dispatched before mapping entity fields for a pull.
SalesforceEvents::PULL_PRESAVE constant Dispatched immediately prior to saving the pulled Drupal entity.
SalesforceEvents::PULL_QUERY constant Dispatched before querying Salesforce to pull records.
SalesforceEvents::PUSH_ALLOWED constant Dispatched before enqueueing or triggering a push event.
SalesforceEvents::PUSH_FAIL constant Dispatched after failed push to Salesforce.
SalesforceEvents::PUSH_MAPPING_OBJECT constant Dispatched immediately before processing a push event.
SalesforceEvents::PUSH_PARAMS constant Dispatched after building params to push to Salesforce.
SalesforceEvents::PUSH_SUCCESS constant Dispatched after successful push to Salesforce.
SalesforceEvents::WARNING constant Dispatched when Salesforce encounters a concerning, but non-error event.