mirror of
https://github.com/code-rhapsodie/dataflow-bundle.git
synced 2026-04-30 01:13:13 +02:00
f0459462f7
* Improved logging * Better handling of default logger * Update src/DataflowType/Dataflow/Dataflow.php * Updated README Co-authored-by: jbcr <51637606+jbcr@users.noreply.github.com>
35 lines
1.1 KiB
PHP
35 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace CodeRhapsodie\DataflowBundle\DependencyInjection\Compiler;
|
|
|
|
use CodeRhapsodie\DataflowBundle\Command\ExecuteDataflowCommand;
|
|
use CodeRhapsodie\DataflowBundle\Runner\PendingDataflowRunner;
|
|
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
|
use Symfony\Component\DependencyInjection\Reference;
|
|
|
|
class DefaultLoggerCompilerPass implements CompilerPassInterface
|
|
{
|
|
/**
|
|
* {@inheritdoc}
|
|
*/
|
|
public function process(ContainerBuilder $container)
|
|
{
|
|
$defaultLogger = $container->getParameter('coderhapsodie.dataflow.default_logger');
|
|
if (!$container->has($defaultLogger)) {
|
|
return;
|
|
}
|
|
|
|
foreach ([ExecuteDataflowCommand::class, PendingDataflowRunner::class] as $serviceId) {
|
|
if (!$container->has($serviceId)) {
|
|
continue;
|
|
}
|
|
|
|
$definition = $container->findDefinition($serviceId);
|
|
$definition->addMethodCall('setLogger', [new Reference($defaultLogger)]);
|
|
}
|
|
}
|
|
}
|