You are here

private function DefaultContentDeployCommands::displayImportResult in Default Content Deploy 8

Display info before/after import.

1 call to DefaultContentDeployCommands::displayImportResult()
DefaultContentDeployCommands::contentDeployImport in src/Commands/DefaultContentDeployCommands.php
Import all the content defined in a content directory.

File

src/Commands/DefaultContentDeployCommands.php, line 348

Class

DefaultContentDeployCommands
Class DefaultContentDeployCommands.

Namespace

Drupal\default_content_deploy\Commands

Code

private function displayImportResult() {
  $result = $this->importer
    ->getResult();
  $array_column = array_column($result, 'status');
  $count = array_count_values($array_column);
  if ($this
    ->output()
    ->isVerbose()) {
    $table = new Table($this
      ->output());
    $table
      ->setHeaders([
      'Action',
      'Entity Type',
      'UUID',
    ]);
    foreach ($result as $uuid => $data) {
      $table
        ->addRow([
        $data['status'],
        $data['entity_type_id'],
        $uuid,
      ]);
    }
    $table
      ->render();
    $this
      ->output()
      ->writeln(dt('Summary:'));
  }
  $this
    ->output()
    ->writeln(dt('- created: @count', [
    '@count' => isset($count['create']) ? $count['create'] : 0,
  ]));
  $this
    ->output()
    ->writeln(dt('- updated: @count', [
    '@count' => isset($count['update']) ? $count['update'] : 0,
  ]));
  $this
    ->output()
    ->writeln(dt('- skipped: @count', [
    '@count' => isset($count['skip']) ? $count['skip'] : 0,
  ]));
}