File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -48,12 +48,11 @@ public function getAdapter(array $config)
48
48
throw new ConnectException ('Could not connect authenticate connection to Redis database. ' );
49
49
}
50
50
}
51
+ $ config ['database ' ] = $ dsn ->getDatabase ();
52
+ }
51
53
52
- if ($ dsn ->getDatabase () !== null ) {
53
- if (false === $ client ->select ($ dsn ->getDatabase ())) {
54
- throw new ConnectException (sprintf ('Could not select Redis database with index "%s". ' , $ dsn ->getDatabase ()));
55
- }
56
- }
54
+ if (null !== $ config ['database ' ] && false === $ client ->select ($ config ['database ' ])) {
55
+ throw new ConnectException (sprintf ('Could not select Redis database with index "%s". ' , $ config ['database ' ]));
57
56
}
58
57
59
58
$ pool = new RedisCachePool ($ client );
@@ -77,11 +76,13 @@ protected static function configureOptionResolver(OptionsResolver $resolver)
77
76
'host ' => '127.0.0.1 ' ,
78
77
'port ' => '6379 ' ,
79
78
'pool_namespace ' => null ,
79
+ 'database ' => null ,
80
80
]
81
81
);
82
82
83
83
$ resolver ->setAllowedTypes ('host ' , ['string ' ]);
84
84
$ resolver ->setAllowedTypes ('port ' , ['string ' , 'int ' ]);
85
85
$ resolver ->setAllowedTypes ('pool_namespace ' , ['string ' , 'null ' ]);
86
+ $ resolver ->setAllowedTypes ('database ' , ['int ' , 'null ' ]);
86
87
}
87
88
}
You can’t perform that action at this time.
0 commit comments