class AcquiaContentHubMappingCommands in Acquia Content Hub 8.2
Drush commands for printing Acquia Content Hub mappings.
@package Drupal\acquia_contenthub\Commands
Hierarchy
- class \Drupal\acquia_contenthub\Commands\AcquiaContentHubMappingCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of AcquiaContentHubMappingCommands
1 string reference to 'AcquiaContentHubMappingCommands'
1 service uses AcquiaContentHubMappingCommands
File
- src/
Commands/ AcquiaContentHubMappingCommands.php, line 13
Namespace
Drupal\acquia_contenthub\CommandsView source
class AcquiaContentHubMappingCommands extends DrushCommands {
/**
* The client factory.
*
* @var \Drupal\acquia_contenthub\Client\ClientFactory
*/
protected $clientFactory;
/**
* AcquiaContentHubMappingCommands constructor.
*
* @param \Drupal\acquia_contenthub\Client\ClientFactory $client_factory
* The client factory.
*/
public function __construct(ClientFactory $client_factory) {
$this->clientFactory = $client_factory;
}
/**
* Shows Elastic Search field mappings from Content Hub.
*
* @command acquia:contenthub-mapping
* @aliases ach-mapping,acquia-contenthub-mapping
*
* @throws \Exception
*/
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."));
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AcquiaContentHubMappingCommands:: |
protected | property | The client factory. | |
AcquiaContentHubMappingCommands:: |
public | function | Shows Elastic Search field mappings from Content Hub. | |
AcquiaContentHubMappingCommands:: |
public | function | AcquiaContentHubMappingCommands constructor. |