diff --git a/Command/ConfigSynchronizeCommand.php b/Command/ConfigSynchronizeCommand.php index ce7ded2..71932ff 100644 --- a/Command/ConfigSynchronizeCommand.php +++ b/Command/ConfigSynchronizeCommand.php @@ -83,11 +83,13 @@ private function executeConfigSet(array $config, string $name, ?string $salesCha $this->output->writeln('---------------------------------------'); foreach ($config as $key => $value) { $currentValue = $this->systemConfigService->get($key, $salesChannelId); - $this->output->writeln(sprintf('Current value: "%s" for key: "%s"', $currentValue, $key)); + $currentValueAsString = $this->valueToString($currentValue); + $valueAsString = $this->valueToString($value); + $this->output->writeln(sprintf('Current value: "%s" for key: "%s"', $currentValueAsString, $key)); // using string comparison for all values (array|bool|float|int|string|null) simplified - if ((string) $currentValue !== (string) $value) { + if ($currentValueAsString !== $valueAsString) { $this->systemConfigService->set($key, $value, $salesChannelId); - $this->output->writeln(sprintf('Changed value to: "%s" for key: "%s"', $value, $key)); + $this->output->writeln(sprintf('Changed value to: "%s" for key: "%s"', $valueAsString, $key)); } else { $this->output->writeln(sprintf('Did not changed the value for key: "%s"', $key)); } @@ -133,4 +135,13 @@ private function getSalesChannels(): array return $salesChannels; } + + private function valueToString($value): string + { + if (is_array($value)) { + return implode(', ', $value); + } + + return (string) $value; + } }