You are here

protected function SalesforceMappingCommands::purgeConfirmAndDelete in Salesforce Suite 8.3

Same name and namespace in other branches
  1. 8.4 modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php \Drupal\salesforce_mapping\Commands\SalesforceMappingCommands::purgeConfirmAndDelete()
  2. 5.0.x modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php \Drupal\salesforce_mapping\Commands\SalesforceMappingCommands::purgeConfirmAndDelete()

Helper to confirm before destructive operation.

3 calls to SalesforceMappingCommands::purgeConfirmAndDelete()
SalesforceMappingCommands::purgeDrupal in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Clean up Mapped Objects referencing missing Drupal entities.
SalesforceMappingCommands::purgeMapping in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Clean up Mapped Objects by deleting records referencing missing Mappings.
SalesforceMappingCommands::purgeSalesforce in modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php
Clean up Mapped Objects by deleting records referencing missing records.

File

modules/salesforce_mapping/src/Commands/SalesforceMappingCommands.php, line 210

Class

SalesforceMappingCommands
A Drush commandfile.

Namespace

Drupal\salesforce_mapping\Commands

Code

protected function purgeConfirmAndDelete(array $object_ids, $extra = '') {
  if (empty($object_ids)) {
    return;
  }
  $message = 'Delete ' . count($object_ids) . ' orphaned mapped objects';
  if ($extra) {
    $message .= ' for ' . $extra;
  }
  $message .= '?';
  if (!$this
    ->io()
    ->confirm($message)) {
    return;
  }

  // Still have to *load* entities in order to delete them. **UGH**.
  $mapped_objs = $this->mappedObjectStorage
    ->loadMultiple($object_ids);
  $this->mappedObjectStorage
    ->delete($mapped_objs);
}