You are here

public function SalesforcePullCommands::pullSet in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_pull/src/Commands/SalesforcePullCommands.php \Drupal\salesforce_pull\Commands\SalesforcePullCommands::pullSet()
  2. 5.0.x modules/salesforce_pull/src/Commands/SalesforcePullCommands.php \Drupal\salesforce_pull\Commands\SalesforcePullCommands::pullSet()

Set a specific pull timestamp on a single Salesforce Mapping.

@option delete Reset delete date timestamp (instead of pull date timestamp) @usage drush sf-pull-set foo Set pull timestamps for mapping "foo" to "now" @usage drush sf-pull-set foo 1517416761 Set pull timestamps for mapping "foo" to 2018-01-31T15:39:21+00:00

@command salesforce_pull:pull-set @aliases sf-pull-set,salesforce_pull:set

Parameters

string $name: Mapping id.

int $time: Timestamp.

array $options: Assoc array of options.

Throws

\Exception

File

modules/salesforce_pull/src/Commands/SalesforcePullCommands.php, line 375

Class

SalesforcePullCommands
A Drush commandfile.

Namespace

Drupal\salesforce_pull\Commands

Code

public function pullSet($name, $time, array $options = [
  'delete' => NULL,
]) {
  $mappings = $this
    ->getPullMappingsFromName($name);
  foreach ($mappings as $mapping) {
    $mapping
      ->setLastPullTime(NULL);
    if ($options['delete']) {
      $mapping
        ->setLastDeleteTime($time);
    }
    else {
      $mapping
        ->setLastPullTime($time);
    }
    $this->mappedObjectStorage
      ->setForcePull($mapping);
    $this
      ->logger()
      ->info(dt('Pull timestamp reset for !name', [
      '!name' => $name,
    ]));
  }
}