You are here

class ImportContentCommand in Tome 8

Contains the tome:import-content command.

@internal

Hierarchy

Expanded class hierarchy of ImportContentCommand

1 string reference to 'ImportContentCommand'
tome_sync.services.yml in modules/tome_sync/tome_sync.services.yml
modules/tome_sync/tome_sync.services.yml
1 service uses ImportContentCommand
tome_sync.import_content_command in modules/tome_sync/tome_sync.services.yml
Drupal\tome_sync\Commands\ImportContentCommand

File

modules/tome_sync/src/Commands/ImportContentCommand.php, line 15

Namespace

Drupal\tome_sync\Commands
View source
class ImportContentCommand extends ImportCommand {

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $this
      ->setName('tome:import-content')
      ->setDescription('Imports given content.')
      ->addArgument('names', InputArgument::REQUIRED, 'A comma separated list of IDs in the format entity_type_id:uuid:langcode.');
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) {
    $names = $input
      ->getArgument('names');
    $names = explode(',', $names);
    foreach ($names as $name) {
      list($entity_type_id, $uuid, $langcode) = TomeSyncHelper::getPartsFromContentName($name);
      $this->importer
        ->importContent($entity_type_id, $uuid, $langcode);
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CommandBase::$executable protected property The current executable path.
CommandBase::$io protected property The IO decorator.
CommandBase::initialize protected function
CommandBase::io protected function Returns the IO decorator, for reporting errors. Overrides ProcessTrait::io
ExecutableFinderTrait::findExecutable protected function Finds an executable string for the current process.
ImportCommand::$entityTypeManager protected property The entity type manager.
ImportCommand::$importer protected property The importer.
ImportCommand::$state protected property The state system.
ImportCommand::checkImportingState protected function Checks the importing state and prompts the user if applicable.
ImportCommand::deleteContent protected function Deletes content using sub-processes.
ImportCommand::ENTITY_COUNT constant The default number of entities to import in each process.
ImportCommand::importChunks protected function Imports chunks of content using sub-processes.
ImportCommand::prepareConfigForImport protected function Prepares config for import by copying some directly from the source.
ImportCommand::PROCESS_COUNT constant The default number of processes to invoke.
ImportCommand::__construct public function Constructs an ImportCommand instance. 2
ImportContentCommand::configure protected function Overrides ImportCommand::configure
ImportContentCommand::execute protected function Overrides ImportCommand::execute
ProcessTrait::displayErrors protected function Displays errors using the IO component.
ProcessTrait::runCommand protected function Runs a single command and outputs errors if encountered.
ProcessTrait::runCommands protected function Runs commands with concurrency.