feat(predis): support json:/csv: env processors for DSN arrays#3
Closed
guillaumedelre wants to merge 1 commit into
Closed
feat(predis): support json:/csv: env processors for DSN arrays#3guillaumedelre wants to merge 1 commit into
guillaumedelre wants to merge 1 commit into
Conversation
Add PredisParametersFactory::createFromDsns() that accepts string|array and handles the nested-array produced by Symfony's json:/csv: env processors. SncRedisExtension now uses createFromDsns for RedisEnvDsn connections so that %env(json:REDIS_DSNS)% resolves correctly at runtime. Signed-off-by: Guillaume Delré <delre.guillaume@gmail.com>
Owner
Author
|
Superseded by snc#759. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PredisParametersFactory::createFromDsns()acceptingstring|arrayto handle DSNs resolved at runtime by Symfony env processorsSncRedisExtensionnow usescreateFromDsns(instead ofcreate) when the DSN is aRedisEnvDsn, so that%env(json:REDIS_DSNS)%or%env(csv:REDIS_DSNS)%resolve correctly at runtime[['redis://host1', 'redis://host2']]) produced when ajson:processor wraps acsv:resultMotivation
Fixes snc#483. Using
%env(json:REDIS_DSNS)%as a predis DSN caused aTypeErrorat runtime becausePredisParametersFactory::create()expectsstring $dsnbut Symfony'sjson:env processor resolves to anarray.Test plan
PredisParametersFactoryTest: 4 new cases coveringcreateFromDsnswith string, single-element array, multiple DSNs, and nested arraySncRedisExtensionEnvTest: newtestPredisJsonEnvDsnfixture + updated factory assertions for existing env tests