You are here

class SettingsCommand in MongoDB 8.2

Class SettingsCommand provides the 'commands.mongodb.settings' command.

@DrupalCommand ( extension="mongodb", extensionType="module" )

Hierarchy

  • class \Drupal\mongodb\Command\SettingsCommand extends \Drupal\Console\Core\Command\ContainerAwareCommand

Expanded class hierarchy of SettingsCommand

1 string reference to 'SettingsCommand'
console.services.yml in modules/mongodb/console.services.yml
modules/mongodb/console.services.yml
1 service uses SettingsCommand
mongodb.mongodb_settings in modules/mongodb/console.services.yml
\Drupal\mongodb\Command\SettingsCommand

File

modules/mongodb/src/Command/SettingsCommand.php, line 23

Namespace

Drupal\mongodb\Command
View source
class SettingsCommand extends ContainerAwareCommand {
  const NAME = 'commands.mongodb.settings';

  /**
   * The mongodb.tools service.
   *
   * @var \Drupal\mongodb\Install\Tools
   */
  protected $tools;

  /**
   * The serialization.yaml service.
   *
   * @var \Drupal\Component\Serialization\SerializationInterface
   */
  protected $serialization;

  /**
   * SettingsCommand constructor.
   *
   * @param \Drupal\mongodb\Install\Tools $tools
   *   The mongodb.tools service.
   * @param \Drupal\Component\Serialization\SerializationInterface $yaml
   *   The serialization.yaml service.
   */
  public function __construct(Tools $tools, SerializationInterface $yaml) {
    parent::__construct();
    $this->serialization = $yaml;
    $this->tools = $tools;
  }

  /**
   * {@inheritdoc}
   */
  protected function configure() {
    $name = static::NAME;
    $this
      ->setName('mongodb:settings')
      ->setAliases([
      'mdbs',
      'mo-set',
    ])
      ->setDescription($this
      ->trans("{$name}.description"))
      ->setHelp($this
      ->trans("{$name}.help"));
  }

  /**
   * {@inheritdoc}
   */
  protected function execute(InputInterface $input, OutputInterface $output) {
    $this
      ->getIo()
      ->write($this->serialization
      ->encode($this->tools
      ->settings()));
  }

}

Members

Namesort descending Modifiers Type Description Overrides
SettingsCommand::$serialization protected property The serialization.yaml service.
SettingsCommand::$tools protected property The mongodb.tools service.
SettingsCommand::configure protected function
SettingsCommand::execute protected function
SettingsCommand::NAME constant
SettingsCommand::__construct public function SettingsCommand constructor.