Skip to content

Commit

Permalink
Improve configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
Thierry Geindre committed Oct 6, 2014
1 parent 2e21a64 commit 28f9d42
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@

/**
* This is the class that loads and manages your bundle configuration
*
* To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html}
*/
class M6WebMonologExtraExtension extends Extension
{
Expand Down Expand Up @@ -50,7 +48,14 @@ public function load(array $configs, ContainerBuilder $container)
$definition->addtag('monolog.processor', $tagOptions);

if (array_key_exists('config', $processor)) {
$definition->addMethodCall('setConfiguration', [$processor['config']]);
$reflextion = new \ReflectionClass($container->getParameter($classParameter));
if ($reflextion->hasMethod('setConfiguration')) {
$definition->addMethodCall('setConfiguration', [$processor['config']]);
} else {
throw new InvalidConfigurationException(
sprintf('"%s" processor is not configurable.', $processor['type'])
);
}
}

$container->setDefinition($serviceId, $definition);
Expand Down

0 comments on commit 28f9d42

Please sign in to comment.