Skip to content

Commit

Permalink
Make symfony/console dependency truly optional
Browse files Browse the repository at this point in the history
Fixes #726
  • Loading branch information
ostrolucky committed Aug 19, 2024
1 parent 98ca9e6 commit 01b68b2
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/Resources/config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Snc\RedisBundle\Command\RedisQueryCommand;
use Snc\RedisBundle\Factory\PhpredisClientFactory;
use Snc\RedisBundle\Logger\RedisCallInterceptor;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\DependencyInjection\Loader\Configurator\InlineServiceConfigurator;
Expand All @@ -26,13 +27,15 @@
->tag('data_collector', ['id' => 'redis', 'template' => '@SncRedis/Collector/redis.html.twig'])
->args([new ReferenceConfigurator('snc_redis.logger')]);

$container->set(RedisQueryCommand::class)
->tag('console.command', ['command' => RedisQueryCommand::COMMAND_NAME])
->args([
tagged_locator('snc_redis.client', 'alias'),
(new ReferenceConfigurator('var_dumper.cli_dumper'))->nullOnInvalid(),
(new ReferenceConfigurator('var_dumper.cloner'))->nullOnInvalid(),
]);
if (class_exists(Command::class)) {
$container->set(RedisQueryCommand::class)
->tag('console.command', ['command' => RedisQueryCommand::COMMAND_NAME])
->args([
tagged_locator('snc_redis.client', 'alias'),
(new ReferenceConfigurator('var_dumper.cli_dumper'))->nullOnInvalid(),
(new ReferenceConfigurator('var_dumper.cloner'))->nullOnInvalid(),
]);
}

$container->set(RedisCallInterceptor::class)
->class(RedisCallInterceptor::class)
Expand Down

0 comments on commit 01b68b2

Please sign in to comment.