@@ -110,6 +110,8 @@ private function addGeneralSection(ArrayNodeDefinition $node)
110110 */
111111 private function addDbalSection (ArrayNodeDefinition $ node )
112112 {
113+ $ dNormalizer = new DriverNormalizer ();
114+ $ dClosure = function ($ v ) use ($ dNormalizer ) { return $ dNormalizer ->normalize ($ v ); };
113115 $ node
114116 ->children ()
115117 ->arrayNode ('dbal ' )
@@ -122,7 +124,7 @@ private function addDbalSection(ArrayNodeDefinition $node)
122124 ->scalarNode ('driver ' )
123125 ->beforeNormalization ()
124126 ->always ()
125- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
127+ ->then ($ dClosure )
126128 ->end ()
127129 ->defaultValue ('mysql ' )
128130 ->end ()
@@ -131,7 +133,7 @@ private function addDbalSection(ArrayNodeDefinition $node)
131133 ->scalarNode ('dsn ' )
132134 ->beforeNormalization ()
133135 ->always ()
134- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
136+ ->then ($ dClosure )
135137 ->end ()
136138 ->defaultValue ('' )
137139 ->end ()
@@ -162,7 +164,7 @@ private function addDbalSection(ArrayNodeDefinition $node)
162164 ->end ()
163165 ->end ()
164166 ->fixXmlConfig ('connection ' )
165- ->append ($ this ->getDbalConnectionsNode ())
167+ ->append ($ this ->getDbalConnectionsNode ($ dNormalizer ))
166168 ->end ()
167169 ;
168170 }
@@ -183,8 +185,10 @@ private function addDbalSection(ArrayNodeDefinition $node)
183185 *
184186 * @return ArrayNodeDefinition|NodeDefinition The tree builder
185187 */
186- private function getDbalConnectionsNode ()
188+ private function getDbalConnectionsNode (DriverNormalizer $ normalizer )
187189 {
190+ $ closure = function ($ v ) use ($ normalizer ) { return $ normalizer ->normalize ($ v ); };
191+
188192 if (Kernel::MAJOR_VERSION > 4 || Kernel::MAJOR_VERSION === 4 && Kernel::MINOR_VERSION >= 2 )
189193 {
190194 $ treeBuilder = new TreeBuilder ('connections ' );
@@ -204,7 +208,7 @@ private function getDbalConnectionsNode()
204208 ->scalarNode ('driver ' )
205209 ->beforeNormalization ()
206210 ->always ()
207- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
211+ ->then ($ closure )
208212 ->end ()
209213 ->defaultValue ('mysql ' )
210214 ->end ()
@@ -213,7 +217,7 @@ private function getDbalConnectionsNode()
213217 ->scalarNode ('dsn ' )
214218 ->beforeNormalization ()
215219 ->always ()
216- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
220+ ->then ($ closure )
217221 ->end ()
218222 ->defaultValue ('' )
219223 ->end ()
@@ -225,7 +229,7 @@ private function getDbalConnectionsNode()
225229 ->scalarNode ('driver ' )
226230 ->beforeNormalization ()
227231 ->always ()
228- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
232+ ->then ($ closure )
229233 ->end ()
230234 ->defaultValue ('mysql ' )
231235 ->end ()
@@ -234,7 +238,7 @@ private function getDbalConnectionsNode()
234238 ->scalarNode ('dsn ' )
235239 ->beforeNormalization ()
236240 ->always ()
237- ->then (function ( $ v ) { return str_replace ( ' pdo_ ' , '' , $ v ); } )
241+ ->then ($ closure )
238242 ->end ()
239243 ->defaultValue ('' )
240244 ->end ()
0 commit comments