You are here

protected function SalesforceMappingCommandsBase::interactMapping in Salesforce Suite 8.4

Same name and namespace in other branches
  1. 8.3 modules/salesforce_mapping/src/Commands/SalesforceMappingCommandsBase.php \Drupal\salesforce_mapping\Commands\SalesforceMappingCommandsBase::interactMapping()
  2. 5.0.x modules/salesforce_mapping/src/Commands/SalesforceMappingCommandsBase.php \Drupal\salesforce_mapping\Commands\SalesforceMappingCommandsBase::interactMapping()

Collect a salesforce mapping interactively.

6 calls to SalesforceMappingCommandsBase::interactMapping()
SalesforceMappingCommands::interactPurgeAll in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Interactively gather a salesforce mapping name.
SalesforceMappingCommands::interactPurgeDrupal in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Interactively gather a salesforce mapping name.
SalesforceMappingCommands::interactPurgeMapping in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Interactively gather a salesforce mapping name.
SalesforceMappingCommands::interactPurgeSalesforce in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Interactively gather a salesforce mapping name.
SalesforceMappingCommandsBase::interactPullMappings in modules/salesforce_mapping/src/Commands/SalesforceMappingCommandsBase.php
Collect a salesforce mapping name, and set it to a "name" argument.

... See full list

File

modules/salesforce_mapping/src/Commands/SalesforceMappingCommandsBase.php, line 75

Class

SalesforceMappingCommandsBase
Shared command base for Salesforce Drush commands.

Namespace

Drupal\salesforce_mapping\Commands

Code

protected function interactMapping(Input $input, Output $output, $message = 'Choose a Salesforce mapping', $allOption = FALSE, $dir = NULL) {
  if ($name = $input
    ->getArgument('name')) {
    if (strtoupper($name) == 'ALL') {
      $input
        ->setArgument('name', 'ALL');
      return;
    }

    /** @var \Drupal\salesforce_mapping\Entity\SalesforceMapping $mapping */
    $mapping = $this->mappingStorage
      ->load($name);
    if (!$mapping) {
      $this
        ->logger()
        ->error(dt('Mapping %name does not exist.', [
        '%name' => $name,
      ]));
    }
    elseif ($dir == 'push' && !$mapping
      ->doesPush()) {
      $this
        ->logger()
        ->error(dt('Mapping %name does not push.', [
        '%name' => $name,
      ]));
    }
    elseif ($dir == 'pull' && !$mapping
      ->doesPull()) {
      $this
        ->logger()
        ->error(dt('Mapping %name does not push.', [
        '%name' => $name,
      ]));
    }
    else {
      return;
    }
  }
  if ($dir == 'pull') {
    $options = $this->mappingStorage
      ->loadPullMappings();
  }
  elseif ($dir == 'push') {
    $options = $this->mappingStorage
      ->loadPushMappings();
  }
  else {
    $options = $this->mappingStorage
      ->loadMultiple();
  }
  $this
    ->doMappingNameOptions($input, array_keys($options), $message, $allOption);
}