|
@@ -49,10 +49,6 @@ class MonologExtension extends Extension
|
|
|
|
|
|
$logger = $container->getDefinition('monolog.logger_prototype');
|
|
|
|
|
|
- if (!empty($config['processors'])) {
|
|
|
- $this->addProcessors($container, $logger, $config['processors']);
|
|
|
- }
|
|
|
-
|
|
|
$handlers = array();
|
|
|
foreach ($config['handlers'] as $name => $handler) {
|
|
|
$handlers[] = array('id' => $this->buildHandler($container, $name, $handler), 'priority' => $handler['priority'] );
|
|
@@ -190,7 +186,11 @@ class MonologExtension extends Extension
|
|
|
|
|
|
case 'swift_mailer':
|
|
|
if (isset($handler['email_prototype'])) {
|
|
|
- $prototype = $this->parseDefinition($handler['email_prototype']);
|
|
|
+ if (!empty($handler['email_prototype']['method'])) {
|
|
|
+ $prototype = array(new Reference($handler['email_prototype']['id']), $handler['email_prototype']['method']);
|
|
|
+ } else {
|
|
|
+ $prototype = new Reference($handler['email_prototype']['id']);
|
|
|
+ }
|
|
|
} else {
|
|
|
$message = new Definition('Swift_Message');
|
|
|
$message->setFactoryService('mailer');
|
|
@@ -238,9 +238,6 @@ class MonologExtension extends Extension
|
|
|
if (!empty($handler['formatter'])) {
|
|
|
$definition->addMethodCall('setFormatter', array(new Reference($handler['formatter'])));
|
|
|
}
|
|
|
- if (!empty($handler['processors'])) {
|
|
|
- $this->addProcessors($container, $definition, $handler['processors']);
|
|
|
- }
|
|
|
$container->setDefinition($handlerId, $definition);
|
|
|
|
|
|
return $handlerId;
|
|
@@ -250,25 +247,4 @@ class MonologExtension extends Extension
|
|
|
{
|
|
|
return sprintf('monolog.handler.%s', $name);
|
|
|
}
|
|
|
-
|
|
|
- private function addProcessors(ContainerBuilder $container, Definition $definition, array $processors)
|
|
|
- {
|
|
|
- foreach (array_reverse($processors) as $processor) {
|
|
|
- $definition->addMethodCall('pushProcessor', array($this->parseDefinition($processor, $container)));
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- private function parseDefinition($definition, ContainerBuilder $container = null)
|
|
|
- {
|
|
|
- if (0 === strpos($definition, '@')) {
|
|
|
- $definition = substr($definition, 1);
|
|
|
- if ($container && $container->hasDefinition($definition)) {
|
|
|
- $container->getDefinition($definition)->setPublic(true);
|
|
|
- }
|
|
|
-
|
|
|
- return new Reference($definition);
|
|
|
- }
|
|
|
-
|
|
|
- return $definition;
|
|
|
- }
|
|
|
}
|