Skip to content

Commit

Permalink
add default parameter values
Browse files Browse the repository at this point in the history
closes #37
  • Loading branch information
Phobetor committed Mar 11, 2018
1 parent e925f72 commit fff62ad
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions DependencyInjection/RabbitMqSupervisorExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,23 +65,30 @@ public function load(array $configs, ContainerBuilder $container)

public function prepend(ContainerBuilder $container)
{
$attributeNames = array('consumers', 'multiple_consumers');
$attributes = array_combine($attributeNames, array_fill(0, count($attributeNames), []));

foreach ($container->getExtensions() as $name => $extension) {
switch ($name) {
case 'old_sound_rabbit_mq':
// take over this bundle's configuration
$extensionConfig = $container->getExtensionConfig($name);

foreach (array('consumers', 'multiple_consumers') as $attribute) {
foreach ($attributeNames as $attribute) {
if (isset($extensionConfig[0][$attribute])) {
$attributeValue = $extensionConfig[0][$attribute];
} else {
$attributeValue = array();
}
$container->setParameter('phobetor_rabbitmq_supervisor.' . $attribute, $attributeValue);
$attributes[$attribute] = $attributeValue;
}
break;
}
}

foreach ($attributes as $name => $value) {
$container->setParameter('phobetor_rabbitmq_supervisor.' . $name, $value);
}
}

public function getAlias()
Expand Down

0 comments on commit fff62ad

Please sign in to comment.