Skip to content

Commit c5f9316

Browse files
authored
Merge pull request #583 from alcaeus/fix-wrong-driver-options-key
Fix wrong driver options key
2 parents df2b8a6 + 9df6164 commit c5f9316

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

DependencyInjection/DoctrineMongoDBExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,7 @@ protected function loadConnections(array $connections, ContainerBuilder $contain
333333
*/
334334
private function normalizeDriverOptions(array $connection)
335335
{
336-
$driverOptions = $connection['driverOptions'] ?? [];
336+
$driverOptions = $connection['driver_options'] ?? [];
337337
$driverOptions['typeMap'] = DocumentManager::CLIENT_TYPEMAP;
338338

339339
if (isset($driverOptions['context'])) {

Tests/DependencyInjection/AbstractMongoDBExtensionTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public function testSingleDocumentManagerConfiguration()
107107
'default' => [
108108
'server' => 'mongodb://localhost:27017',
109109
'options' => [],
110+
'driver_options' => ['context' => 'my_context'],
110111
],
111112
],
112113
'document_managers' => ['default' => []],
@@ -121,6 +122,8 @@ public function testSingleDocumentManagerConfiguration()
121122
$this->assertEquals([], $arguments[1]);
122123
$this->assertArrayHasKey('typeMap', $arguments[2]);
123124
$this->assertSame(['root' => 'array', 'document' => 'array'], $arguments[2]['typeMap']);
125+
$this->assertArrayHasKey('context', $arguments[2]);
126+
$this->assertEquals(new Reference('my_context'), $arguments[2]['context']);
124127

125128
$definition = $container->getDefinition('doctrine_mongodb.odm.default_document_manager');
126129
$this->assertEquals('%doctrine_mongodb.odm.document_manager.class%', $definition->getClass());

0 commit comments

Comments
 (0)