You are here

class SalesforcePushAllowedEvent in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_mapping/src/Event/SalesforcePushAllowedEvent.php \Drupal\salesforce_mapping\Event\SalesforcePushAllowedEvent
  2. 5.0.x modules/salesforce_mapping/src/Event/SalesforcePushAllowedEvent.php \Drupal\salesforce_mapping\Event\SalesforcePushAllowedEvent

Push allowed event.

Hierarchy

Expanded class hierarchy of SalesforcePushAllowedEvent

2 files declare their use of SalesforcePushAllowedEvent
SalesforceExampleSubscriber.php in modules/salesforce_example/src/EventSubscriber/SalesforceExampleSubscriber.php
salesforce_push.module in modules/salesforce_push/salesforce_push.module
Push updates to Salesforce when a Drupal entity is updated.

File

modules/salesforce_mapping/src/Event/SalesforcePushAllowedEvent.php, line 10

Namespace

Drupal\salesforce_mapping\Event
View source
class SalesforcePushAllowedEvent extends SalesforcePushOpEvent {

  /**
   * Indicates whether push is allowed to continue.
   *
   * @var bool
   */
  protected $pushAllowed;

  /**
   * SalesforcePushAllowedEvent dispatched before building PushParams.
   *
   * @param \Drupal\salesforce_mapping\Entity\MappedObjectInterface $mapped_object
   *   The mapped object.
   * @param string $op
   *   One of
   *     Drupal\salesforce_mapping\MappingConstants::
   *       SALESFORCE_MAPPING_SYNC_DRUPAL_CREATE
   *       SALESFORCE_MAPPING_SYNC_DRUPAL_UPDATE
   *       SALESFORCE_MAPPING_SYNC_DRUPAL_DELETE.
   */
  public function __construct(MappedObjectInterface $mapped_object, $op) {
    parent::__construct($mapped_object, $op);
    $this->op = $op;
  }

  /**
   * Returns FALSE if push is disallowed.
   *
   * Note: a subscriber cannot "force" a push when any other subscriber has
   * disallowed it.
   *
   * @return false|null
   *   Returns FALSE if PUSH_ALLOWED event has been fired, and any subscriber
   *   wants to prevent push. Otherwise, returns NULL.
   */
  public function isPushAllowed() {
    return $this->pushAllowed === FALSE ? FALSE : NULL;
  }

  /**
   * Stop Salesforce record from being pushed.
   *
   * @return $this
   */
  public function disallowPush() {
    $this->pushAllowed = FALSE;
    return $this;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SalesforcePushAllowedEvent::$pushAllowed protected property Indicates whether push is allowed to continue.
SalesforcePushAllowedEvent::disallowPush public function Stop Salesforce record from being pushed.
SalesforcePushAllowedEvent::isPushAllowed public function Returns FALSE if push is disallowed.
SalesforcePushAllowedEvent::__construct public function SalesforcePushAllowedEvent dispatched before building PushParams. Overrides SalesforcePushOpEvent::__construct
SalesforcePushEvent::$entity protected property The Drupal entity.
SalesforcePushEvent::$mappedObject protected property The mapped object.
SalesforcePushEvent::$mapping protected property The mapping.
SalesforcePushEvent::getEntity public function Getter.
SalesforcePushEvent::getMappedObject public function Getter.
SalesforcePushEvent::getMapping public function Getter.
SalesforcePushOpEvent::$op protected property The pull operation.
SalesforcePushOpEvent::getOp public function Getter for the pull operation.