AcquiaContentHubMappingCommands.php in Acquia Content Hub 8.2
File
src/Commands/AcquiaContentHubMappingCommands.php
View source
<?php
namespace Drupal\acquia_contenthub\Commands;
use Drupal\acquia_contenthub\Client\ClientFactory;
use Drush\Commands\DrushCommands;
class AcquiaContentHubMappingCommands extends DrushCommands {
protected $clientFactory;
public function __construct(ClientFactory $client_factory) {
$this->clientFactory = $client_factory;
}
public function contenthubMapping() {
$client = $this->clientFactory
->getClient();
if (!$client) {
throw new \Exception(dt('Error trying to connect to the Content Hub. Make sure this site is registered to Content hub.'));
}
$output = $client
->mapping();
if ($output) {
$this
->output()
->writeln(print_r($output, TRUE));
}
else {
throw new \Exception(dt("Error trying to print the elastic search field mappings."));
}
}
}