You are here

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

Create an Import Entity from the tar.gz file absolute path.

@usage content:synchronizer-create-import absolute path Usage description

@command content:synchronizer-create-import @aliases csci

Parameters

string $absolutePath: Argument description.

Return value

\Drupal\content_synchronizer\Entity\ImportEntityInterface|int|string|null The ImportEntity generated.

Throws

\Drupal\Core\Entity\EntityStorageException

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

File

src/Commands/ContentSynchronizerCommands.php, line 145

Class

ContentSynchronizerCommands
A Drush commandfile.

Namespace

Drupal\content_synchronizer\Commands

Code

public function createImport($absolutePath = NULL) {
  $absolutePath = $absolutePath ?: $this
    ->io()
    ->ask($this
    ->t('File to import ?'), '', [
    $this->contentSynchronizerManager,
    'tarGzExists',
  ]);
  $ie = $this->contentSynchronizerManager
    ->createImportFromTarGzFilePath($absolutePath);
  $this->logger
    ->notice($this
    ->t('Import Entity has been created (ID : @ieId)', [
    '@ieId' => $ie
      ->id(),
  ]));
  return $ie;
}