Skip to content

Commit

Permalink
Fix 3223 config import single (#3224)
Browse files Browse the repository at this point in the history
* issue #2131 Removed config.factory service extra in generate:form command

* #3223 Fixed config:import:single

* #3223 Fixed config:import:single - improved validation
  • Loading branch information
igasi authored and jmolivas committed Mar 15, 2017
1 parent 8bffedf commit 3e9435b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/Command/Config/ImportSingleCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$io = new DrupalStyle($input, $output);

$name = $input->getOption('name');
$name = is_array($name) ? $name : [$name];
$directory = $input->getOption('directory');
$file = $input->getOption('file');

Expand All @@ -103,10 +104,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
$nameItem = substr($nameItem, 0, -4);
}

$configFile = $directory.DIRECTORY_SEPARATOR.$nameItem.'.yml';
$configFile = count($name) == 1 ?
$file :
$directory.DIRECTORY_SEPARATOR.$nameItem.'.yml';

if (file_exists($configFile)) {
$value = $ymlFile->parse(file_get_contents($configFile));
$source_storage->replaceData($nameItem, $value);
$source_storage->delete($nameItem);
$source_storage->write($nameItem, $value);
continue;
}

Expand All @@ -120,6 +125,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->configManager
);


if ($this->configImport($io, $storageComparer)) {
$io->success(
sprintf(
Expand Down

0 comments on commit 3e9435b

Please sign in to comment.