Skip to content

Commit 07fb095

Browse files
committed
simplify getting overrides
1 parent 8a3bff2 commit 07fb095

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

DependencyInjection/DoctrineExtension.php

+1-7
Original file line numberDiff line numberDiff line change
@@ -286,13 +286,7 @@ protected function getConnectionOptions($connection)
286286
}
287287

288288
if ($allowOverrideUrl) {
289-
foreach (array_keys($connectionDefaults) as $paramName) {
290-
if (! array_key_exists($paramName, $options)) {
291-
continue;
292-
}
293-
294-
$options['connection_override_options'][$paramName] = $options[$paramName];
295-
}
289+
$options['connection_override_options'] = array_intersect_key($options, $connectionDefaults);
296290
}
297291

298292
unset($options['override_url'], $connectionDefaults['dbname']);

Tests/DependencyInjection/AbstractDoctrineExtensionTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public function testDbalLoadUrlOverride(): void
134134
$this->assertSame($value, $config[$param]);
135135
}
136136

137-
$this->assertSame($expectedOverrides, $config['connection_override_options']);
137+
$this->assertEquals($expectedOverrides, $config['connection_override_options']);
138138
$this->assertFalse(isset($config['override_url']));
139139
}
140140

0 commit comments

Comments
 (0)