You are here

public function ContentSynchronizerCommands::launchImport in Content Synchronizer 3.x

Launch the import of the import entity ID.

@option publish Autopublish imported content : publish|unpublish @option update Update stategy : systematic|if_recent|no_update

@command content:synchronizer-launch-import @aliases cslim,content-synchronizer-launch-import

Parameters

int $importId: The import id.

array $options: An associative array of options whose values come from cli, aliases, config, etc.

Throws

\Exception

1 call to ContentSynchronizerCommands::launchImport()
ContentSynchronizerCommands::createAndLaunchImport in src/Commands/ContentSynchronizerCommands.php
Launch the import of the import entity ID.

File

src/Commands/ContentSynchronizerCommands.php, line 175

Class

ContentSynchronizerCommands
A Drush commandfile.

Namespace

Drupal\content_synchronizer\Commands

Code

public function launchImport($importId, array $options = [
  'publish' => FALSE,
  'update' => FALSE,
]) {

  // Publish option.
  if (!$options['publish']) {
    $options['publish'] = $this
      ->choice($this
      ->t('Action on entity creation'), LaunchImportForm::getCreateOptions(), ImportProcessor::DEFAULT_PUBLICATION_TYPE);
  }

  // Update option.
  if (!$options['update']) {
    $options['update'] = $this
      ->choice($this
      ->t('Action on entity update'), LaunchImportForm::getUpdateOptions(), ImportProcessor::DEFAULT_UPDATE_TYPE);
  }
  $this
    ->logImportData($this->contentSynchronizerManager
    ->launchImport($importId, $options['publish'], $options['update']));
}