You are here

public function AcquiaContenthubCommands::contenthubMapping in Acquia Content Hub 8

Shows Elastic Search field mappings from Content Hub.

@command acquia:contenthub-mapping @aliases ach-mapping,acquia-contenthub-mapping

File

src/Commands/AcquiaContenthubCommands.php, line 474

Class

AcquiaContenthubCommands
A Drush commandfile.

Namespace

Drupal\acquia_contenthub\Commands

Code

public function contenthubMapping() {

  /** @var \Drupal\acquia_contenthub\Client\ClientManager $client_manager */
  $client_manager = \Drupal::service('acquia_contenthub.client_manager');
  if ($client_manager
    ->isConnected()) {
    $output = $client_manager
      ->createRequest('mapping');
  }
  else {
    throw new \Exception(dt('Error trying to connect to the Content Hub. Make sure this site is registered to Content hub.'));
  }
  if ($output) {
    $this
      ->output()
      ->writeln(print_r($output, TRUE));
  }
  else {
    throw new \Exception(dt("Error trying to print the elastic search field mappings."));
  }
}