diff --git a/src/Resources/config/services.php b/src/Resources/config/services.php index 46c11e19..4e115327 100644 --- a/src/Resources/config/services.php +++ b/src/Resources/config/services.php @@ -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; @@ -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)