Skip to content

Commit

Permalink
correct default config valures
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladyslav Riabchenko committed Jun 28, 2019
1 parent 8ca5e56 commit 84f1496
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/Config/ConfigurationTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,23 @@ public function configureAnonymizer(ArrayNodeDefinition $node)
return \is_array($v) && \array_key_exists('defaults', $v) && \is_array($v['defaults']);
})
->then(static function ($c) {
foreach ($c['tables'] ?? [] as &$tableConfig) {
foreach ($tableConfig['fields'] ?? [] as &$fieldConfig) {
foreach ($c['defaults'] ?? [] as $defaultKey => $defaultValue) {
if (!\array_key_exists($defaultKey, $fieldConfig)) {
$fieldConfig[$defaultKey] = $defaultValue;
if (isset($c['tables'])) {
foreach ($c['tables'] as &$tableConfig) {
if ($tableConfig['fields']) {
foreach ($tableConfig['fields'] as &$fieldConfig) {
if (isset($c['defaults'])) {
foreach ($c['defaults'] as $defaultKey => $defaultValue) {
if (!\array_key_exists($defaultKey, $fieldConfig)) {
$fieldConfig[$defaultKey] = $defaultValue;
}
}
}
}
}
}
}


return $c;
})
->end()
Expand Down

0 comments on commit 84f1496

Please sign in to comment.