SettingsCommand.php in MongoDB 8.2
File
modules/mongodb/src/Command/SettingsCommand.php
View source
<?php
declare (strict_types=1);
namespace Drupal\mongodb\Command;
use Drupal\Component\Serialization\SerializationInterface;
use Drupal\mongodb\Install\Tools;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Drupal\Console\Core\Command\ContainerAwareCommand;
use Drupal\Console\Annotations\DrupalCommand;
class SettingsCommand extends ContainerAwareCommand {
const NAME = 'commands.mongodb.settings';
protected $tools;
protected $serialization;
public function __construct(Tools $tools, SerializationInterface $yaml) {
parent::__construct();
$this->serialization = $yaml;
$this->tools = $tools;
}
protected function configure() {
$name = static::NAME;
$this
->setName('mongodb:settings')
->setAliases([
'mdbs',
'mo-set',
])
->setDescription($this
->trans("{$name}.description"))
->setHelp($this
->trans("{$name}.help"));
}
protected function execute(InputInterface $input, OutputInterface $output) {
$this
->getIo()
->write($this->serialization
->encode($this->tools
->settings()));
}
}
Classes
Name |
Description |
SettingsCommand |
Class SettingsCommand provides the 'commands.mongodb.settings' command. |