Skip to content

Commit

Permalink
throw exception if module does not exist - fixes #3609 (#3625)
Browse files Browse the repository at this point in the history
  • Loading branch information
malcomio authored and jmolivas committed Jan 7, 2018
1 parent 317211a commit f4e4437
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/Command/Shared/ExportTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

use Drupal\Component\Serialization\Yaml;
use Drupal\Console\Core\Style\DrupalStyle;
use Symfony\Component\Console\Exception\InvalidOptionException;

/**
* Class ConfigExportTrait
Expand Down Expand Up @@ -72,14 +73,18 @@ protected function exportConfig($directory, DrupalStyle $io, $message)
}

/**
* @param string $module
* @param string $moduleName
* @param DrupalStyle $io
*/
protected function exportConfigToModule($module, DrupalStyle $io, $message)
protected function exportConfigToModule($moduleName, DrupalStyle $io, $message)
{
$io->info($message);

$module = $this->extensionManager->getModule($module);
$module = $this->extensionManager->getModule($moduleName);

if (empty($module)) {
throw new InvalidOptionException(sprintf('The module %s does not exist.', $moduleName));
}

foreach ($this->configExport as $fileName => $config) {
$yamlConfig = Yaml::encode($config['data']);
Expand Down

0 comments on commit f4e4437

Please sign in to comment.