class ConfigSplitCommands in Configuration Split 2.0.x
Same name and namespace in other branches
- 8 src/Commands/ConfigSplitCommands.php \Drupal\config_split\Commands\ConfigSplitCommands
The Drush 10 commands.
Hierarchy
- class \Drupal\config_split\Commands\ConfigSplitCommands extends \Drush\Commands\DrushCommands
Expanded class hierarchy of ConfigSplitCommands
1 string reference to 'ConfigSplitCommands'
1 service uses ConfigSplitCommands
File
- src/
Commands/ ConfigSplitCommands.php, line 14
Namespace
Drupal\config_split\CommandsView source
class ConfigSplitCommands extends DrushCommands {
/**
* The interoperability cli service.
*
* @var \Drupal\config_split\ConfigSplitCliService
*/
protected $cliService;
/**
* ConfigSplitCommands constructor.
*
* @param \Drupal\config_split\ConfigSplitCliService $cliService
* The CLI service which allows interoperability.
*/
public function __construct(ConfigSplitCliService $cliService) {
parent::__construct();
$this->cliService = $cliService;
}
/**
* Export only split configuration to a directory.
*
* @param string $split
* The split configuration to export.
*
* @command config-split:export
*
* @usage drush config-split:export development
* Export configuration of the "development" split
*
* Propose an alias at:
* https://www.drupal.org/project/config_split/issues/3181368
*/
public function splitExport($split) {
return $this->cliService
->ioExport($split, $this
->io(), 'dt');
}
/**
* Import only config from a split.
*
* @param string $split
* The split configuration to import.
*
* @command config-split:import
*
* @usage drush config-split:import development
* Import configuration of the "development" split
*
* Propose an alias at:
* https://www.drupal.org/project/config_split/issues/3181368
*/
public function splitImport($split) {
return $this->cliService
->ioImport($split, $this
->io(), 'dt');
}
/**
* Activate a config split.
*
* @param string $split
* The split configuration to activate.
*
* @command config-split:activate
*
* @usage drush config-split:activate development
* Activate configuration of the "development" split
*
* Propose an alias at:
* https://www.drupal.org/project/config_split/issues/3181368
*/
public function splitActivate($split) {
return $this->cliService
->ioActivate($split, $this
->io(), 'dt');
}
/**
* Deactivate a config split.
*
* @param string $split
* The split configuration to deactivate.
*
* @command config-split:deactivate
*
* @usage drush config-split:deactivate development
* Deactivate configuration of the "development" split
*
* Propose an alias at:
* https://www.drupal.org/project/config_split/issues/3181368
*/
public function splitDeactivate($split) {
return $this->cliService
->ioDeactivate($split, $this
->io(), 'dt');
}
/**
* Override the status of a split via state.
*
* @param string $name
* The split name.
* @param string|int|bool $status
* One of: active|1|true| inactive|0|false| default||null|none.
*
* @command config-split:status-override
*
* @usage drush config-split:status-override development active
* Set (or get without a status argument) the status config override.
*
* @aliases csso
*/
public function statusConfigOverride(string $name, $status = '') {
$this->cliService
->statusOverride($name, $status, $this
->io(), 'dt');
}
/**
* React to the config export, write the splits to their storages.
*
* @hook post-command config:export
*/
public function postConfigExport($result, CommandData $commandData) {
// The config export command aborts if it is not exporting.
// So here we know that the config was exported, so we need to also export
// the split config to where they need to be.
$this->cliService
->postExportAll();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
ConfigSplitCommands:: |
protected | property | The interoperability cli service. | |
ConfigSplitCommands:: |
public | function | React to the config export, write the splits to their storages. | |
ConfigSplitCommands:: |
public | function | Activate a config split. | |
ConfigSplitCommands:: |
public | function | Deactivate a config split. | |
ConfigSplitCommands:: |
public | function | Export only split configuration to a directory. | |
ConfigSplitCommands:: |
public | function | Import only config from a split. | |
ConfigSplitCommands:: |
public | function | Override the status of a split via state. | |
ConfigSplitCommands:: |
public | function | ConfigSplitCommands constructor. |