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)
4848 throw new ConnectException ('Could not connect authenticate connection to Redis database. ' );
4949 }
5050 }
51+ $ config ['database ' ] = $ dsn ->getDatabase ();
52+ }
5153
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 ' ]));
5756 }
5857
5958 $ pool = new RedisCachePool ($ client );
@@ -77,11 +76,13 @@ protected static function configureOptionResolver(OptionsResolver $resolver)
7776 'host ' => '127.0.0.1 ' ,
7877 'port ' => '6379 ' ,
7978 'pool_namespace ' => null ,
79+ 'database ' => null ,
8080 ]
8181 );
8282
8383 $ resolver ->setAllowedTypes ('host ' , ['string ' ]);
8484 $ resolver ->setAllowedTypes ('port ' , ['string ' , 'int ' ]);
8585 $ resolver ->setAllowedTypes ('pool_namespace ' , ['string ' , 'null ' ]);
86+ $ resolver ->setAllowedTypes ('database ' , ['int ' , 'null ' ]);
8687 }
8788}
You can’t perform that action at this time.
0 commit comments