You are here

class EntityShareClientCommands in Entity Share 8

Same name and namespace in other branches
  1. 8.3 modules/entity_share_client/src/Commands/EntityShareClientCommands.php \Drupal\entity_share_client\Commands\EntityShareClientCommands
  2. 8.2 modules/entity_share_client/src/Commands/EntityShareClientCommands.php \Drupal\entity_share_client\Commands\EntityShareClientCommands

Class EntityShareClientCommands.

This is the Drush 9 commands.

@package Drupal\entity_share_client\Commands

Hierarchy

Expanded class hierarchy of EntityShareClientCommands

1 string reference to 'EntityShareClientCommands'
drush.services.yml in modules/entity_share_client/drush.services.yml
modules/entity_share_client/drush.services.yml
1 service uses EntityShareClientCommands
entity_share_client.commands in modules/entity_share_client/drush.services.yml
\Drupal\entity_share_client\Commands\EntityShareClientCommands

File

modules/entity_share_client/src/Commands/EntityShareClientCommands.php, line 15

Namespace

Drupal\entity_share_client\Commands
View source
class EntityShareClientCommands extends DrushCommands {

  /**
   * The interoperability cli service.
   *
   * @var \Drupal\entity_share_client\Service\EntityShareClientCliService
   */
  protected $cliService;

  /**
   * EntityShareClientCommands constructor.
   *
   * @param \Drupal\entity_share_client\Service\EntityShareClientCliService $cliService
   *   The CLI service which allows interoperability.
   */
  public function __construct(EntityShareClientCliService $cliService) {
    $this->cliService = $cliService;
  }

  /**
   * Pull a channel from a remote website.
   *
   * @param string $remote_id
   *   The remote website id to import from.
   * @param string $channel_id
   *   The remote channel id to import.
   * @param array $options
   *   Additional Drush 9 command options.
   *
   * @command entity-share-client:pull
   * @options update Optional --update argument which denotes script to fetch only new and updated entities.
   * @usage drush entity-share-client:pull remote_id channel_id --update
   *   Pull a channel from a remote website. Add --update option to fetch only new and updated entities.
   */
  public function pullChannel($remote_id = '', $channel_id = '', $options = [
    'update' => FALSE,
  ]) {
    if ($options['update']) {
      $this->cliService
        ->ioPullUpdates($remote_id, $channel_id, $this
        ->io(), 'dt');
    }
    else {
      $this->cliService
        ->ioPull($remote_id, $channel_id, $this
        ->io(), 'dt');
    }
  }

}

Members

Namesort descending Modifiers Type Description Overrides
EntityShareClientCommands::$cliService protected property The interoperability cli service.
EntityShareClientCommands::pullChannel public function Pull a channel from a remote website.
EntityShareClientCommands::__construct public function EntityShareClientCommands constructor.