From 5d8169e961901fdc652e00bcbb1974cc966aef8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linas=20Merkevi=C4=8Dius?= Date: Wed, 9 May 2018 11:08:39 +0300 Subject: [PATCH] Create cluster connection correctly for one host (#416) * Create cluster connection correctly * Unset replication option if cluster option is defined for predis client --- DependencyInjection/SncRedisExtension.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/SncRedisExtension.php b/DependencyInjection/SncRedisExtension.php index c2b34e2a..ee23bef6 100644 --- a/DependencyInjection/SncRedisExtension.php +++ b/DependencyInjection/SncRedisExtension.php @@ -132,6 +132,8 @@ protected function loadPredisClient(array $client, ContainerBuilder $container) { if (null === $client['options']['cluster']) { unset($client['options']['cluster']); + } else { + unset($client['options']['replication']); } // predis connection parameters have been renamed in v0.8 @@ -207,7 +209,7 @@ protected function loadPredisClient(array $client, ContainerBuilder $container) $clientDef = new Definition($container->getParameter('snc_redis.client.class')); $clientDef->setPublic(true); $clientDef->addTag('snc_redis.client', array('alias' => $client['alias'])); - if (1 === $connectionCount) { + if (1 === $connectionCount && !isset($client['options']['cluster'])) { $clientDef->addArgument(new Reference(sprintf('snc_redis.connection.%s_parameters.%s', $connectionAliases[0], $client['alias']))); } else { $connections = array();