Skip to content

Commit

Permalink
bug #37268 [Messenger] Fix precedence of DSN options for 4.4 (jderusse)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.4 branch.

Discussion
----------

[Messenger] Fix precedence of DSN options for 4.4

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | symfony/symfony#37218 (comment)
| License       | MIT
| Doc PR        | N/A

This PR fix précédence of DSN options over constructor options in all component on branch 4.4

Commits
-------

992205a759 Fix precendence in 4.4
  • Loading branch information
nicolas-grekas committed Jun 18, 2020
2 parents fb13410 + bf7dc00 commit 86a38d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions Tests/Transport/Doctrine/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public function buildConfigurationProvider(): iterable
'expectedAutoSetup' => false,
];

yield 'options from options array wins over options from dsn' => [
yield 'options from dsn array wins over options from options' => [
'dsn' => 'doctrine://default?table_name=name_from_dsn&redeliver_timeout=1200&queue_name=normal&auto_setup=true',
'options' => [
'table_name' => 'name_from_options',
Expand All @@ -218,10 +218,10 @@ public function buildConfigurationProvider(): iterable
'auto_setup' => false,
],
'expectedConnection' => 'default',
'expectedTableName' => 'name_from_options',
'expectedRedeliverTimeout' => 1800,
'expectedQueue' => 'important',
'expectedAutoSetup' => false,
'expectedTableName' => 'name_from_dsn',
'expectedRedeliverTimeout' => 1200,
'expectedQueue' => 'normal',
'expectedAutoSetup' => true,
];

yield 'options from dsn with falsey boolean' => [
Expand Down
2 changes: 1 addition & 1 deletion Transport/Doctrine/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static function buildConfiguration(string $dsn, array $options = []): arr
}

$configuration = ['connection' => $components['host']];
$configuration += $options + $query + self::DEFAULT_OPTIONS;
$configuration += $query + $options + self::DEFAULT_OPTIONS;

$configuration['auto_setup'] = filter_var($configuration['auto_setup'], FILTER_VALIDATE_BOOLEAN);

Expand Down

0 comments on commit 86a38d0

Please sign in to comment.