Skip to content

Commit ee1cdeb

Browse files
authored
Merge pull request #403 from alcaeus/fix-empty-driver-options
Fix driver option inconsistencies
2 parents 1115db4 + 81befd9 commit ee1cdeb

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

DependencyInjection/Configuration.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private function addConnectionsSection(ArrayNodeDefinition $rootNode)
303303
})
304304
->end()
305305
->end()
306-
->arrayNode('driverOptions')
306+
->arrayNode('driver_options')
307307
->performNoDeepMerging()
308308
->children()
309309
->scalarNode('context')->defaultNull()->end()

DependencyInjection/DoctrineMongoDBExtension.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -312,15 +312,15 @@ protected function loadConnections(array $connections, ContainerBuilder $contain
312312
*/
313313
private function normalizeDriverOptions(array $connection)
314314
{
315-
if (! isset($connection['driverOptions'])) {
316-
return null;
315+
if (! isset($connection['driver_options'])) {
316+
return [];
317317
}
318318

319-
if (isset($connection['driverOptions']['context'])) {
320-
$connection['driverOptions']['context'] = new Reference($connection['driverOptions']['context']);
319+
if (isset($connection['driver_options']['context'])) {
320+
$connection['driver_options']['context'] = new Reference($connection['driver_options']['context']);
321321
}
322322

323-
return $connection['driverOptions'];
323+
return $connection['driver_options'];
324324
}
325325

326326
/**

Resources/config/schema/mongodb-1.0.xsd

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<xsd:complexType name="connection">
5050
<xsd:sequence>
5151
<xsd:element name="options" type="connection-options" minOccurs="0" maxOccurs="1" />
52-
<xsd:element name="driverOptions" type="connection-driver-options" minOccurs="0" maxOccurs="1" />
52+
<xsd:element name="driver-options" type="connection-driver-options" minOccurs="0" maxOccurs="1" />
5353
</xsd:sequence>
5454
<xsd:attribute name="id" type="xsd:string" use="required" />
5555
<xsd:attribute name="server" type="xsd:string" />

Resources/doc/config.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,8 @@ You can then use this service in your configuration:
479479
480480
<doctrine:mongodb>
481481
<doctrine:connection id="default" server="mongodb://localhost:27017"/>
482-
<doctrine:driverOptions
483-
context="app.mongodb.context_service"
482+
<doctrine:driver-options
483+
context="app.mongodb.context_service"
484484
>
485485
</doctrine:options>
486486
</doctrine:connection>

Tests/DependencyInjection/ConfigurationTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public function testFullConfiguration($config)
107107
'w' => 'majority',
108108
'wTimeoutMS' => 1000,
109109
],
110-
'driverOptions' => [
110+
'driver_options' => [
111111
'context' => 'conn1_context_service',
112112
],
113113
],

Tests/DependencyInjection/Fixtures/config/xml/full.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
</doctrine:readPreferenceTags>
5959
<doctrine:readPreferenceTags />
6060
</doctrine:options>
61-
<doctrine:driverOptions
61+
<doctrine:driver-options
6262
context="conn1_context_service"
6363
/>
6464
</doctrine:connection>

Tests/DependencyInjection/Fixtures/config/yml/full.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ doctrine_mongodb:
4747
username: username_val
4848
w: majority
4949
wTimeoutMS: 1000
50-
driverOptions:
50+
driver_options:
5151
context: conn1_context_service
5252
conn2:
5353
server: mongodb://otherhost

0 commit comments

Comments
 (0)