Skip to content

Commit

Permalink
requested change: replace new ServiceDefinition with $builder->addDef…
Browse files Browse the repository at this point in the history
…inition
  • Loading branch information
haltuf committed May 30, 2019
1 parent c27cafb commit 92beb8e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/DI/MonologExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Nette\Configurator;
use Nette\DI\Compiler;
use Nette\DI\Config\Helpers;
use Nette\DI\Definitions\ServiceDefinition;
use Nette\DI\Helpers as DIHelpers;
use Nette\DI\Statement;
use Nette\PhpGenerator\ClassType as ClassTypeGenerator;
Expand Down Expand Up @@ -109,12 +108,9 @@ protected function loadHandlers(array $config): void

foreach ($config['handlers'] as $handlerName => $implementation) {

$sd = new ServiceDefinition();
$sd->setFactory($implementation)->setAutowired(FALSE);
$serviceName = $this->prefix('handler.' . $handlerName);
$builder->addDefinition($serviceName, $sd);

$builder->getDefinition($serviceName)
$builder->addDefinition($this->prefix('handler.' . $handlerName))
->setFactory($implementation)
->setAutowired(FALSE)
->addTag(self::TAG_HANDLER)
->addTag(self::TAG_PRIORITY, is_numeric($handlerName) ? $handlerName : 0);
}
Expand Down

0 comments on commit 92beb8e

Please sign in to comment.