snc/SncRedisBundle

Database parameter is not applied from config

specdrum-agc opened this issue · 3 comments

I have next config:

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsns:
                - '%env(REDIS_DSN)%'
            options:
                parameters:
                    database: 5

But database parameter is not applied and data is written to default database.

Configuration sets this array one level deeper than required by predis/predis:

predis\predis\src\Connection\Factory.php:

image

snc\redis-bundle\src\DependencyInjection\SncRedisExtension.php:

image

It might be fixed several ways, so I think it would be better if main contributors decide how to fix this.

This is as designed, otherwise when defining DSN, whoever designs it would have to know if database has been specified as non-dsn in order to know if they have to specify it in DSN or not. For some more context see here where we had same issue in doctrine-bundle doctrine/DoctrineBundle#1328 (comment)