Skip to content

Commit

Permalink
Merge pull request doctrine#583 from alcaeus/fix-wrong-driver-options…
Browse files Browse the repository at this point in the history
…-key

Fix wrong driver options key
  • Loading branch information
alcaeus authored Sep 24, 2019
2 parents df2b8a6 + 9df6164 commit c5f9316
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DependencyInjection/DoctrineMongoDBExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ protected function loadConnections(array $connections, ContainerBuilder $contain
*/
private function normalizeDriverOptions(array $connection)
{
$driverOptions = $connection['driverOptions'] ?? [];
$driverOptions = $connection['driver_options'] ?? [];
$driverOptions['typeMap'] = DocumentManager::CLIENT_TYPEMAP;

if (isset($driverOptions['context'])) {
Expand Down
3 changes: 3 additions & 0 deletions Tests/DependencyInjection/AbstractMongoDBExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function testSingleDocumentManagerConfiguration()
'default' => [
'server' => 'mongodb://localhost:27017',
'options' => [],
'driver_options' => ['context' => 'my_context'],
],
],
'document_managers' => ['default' => []],
Expand All @@ -121,6 +122,8 @@ public function testSingleDocumentManagerConfiguration()
$this->assertEquals([], $arguments[1]);
$this->assertArrayHasKey('typeMap', $arguments[2]);
$this->assertSame(['root' => 'array', 'document' => 'array'], $arguments[2]['typeMap']);
$this->assertArrayHasKey('context', $arguments[2]);
$this->assertEquals(new Reference('my_context'), $arguments[2]['context']);

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

0 comments on commit c5f9316

Please sign in to comment.