Skip to content

Commit

Permalink
Remove deprecated configuration (#819)
Browse files Browse the repository at this point in the history
  • Loading branch information
GromNaN authored Dec 20, 2023
1 parent 983ec4c commit 0281da7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 41 deletions.
20 changes: 0 additions & 20 deletions DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->integerNode('timeout')->end()
->scalarNode('w')->end()
->integerNode('wtimeout')->end()
// Deprecated options
->booleanNode('fsync')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "fsync" is deprecated. Use "j" option instead.')
->end()
->scalarNode('safe')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "safe" is deprecated. Use "w" option instead.')
->end()
->end()
->end()
->arrayNode('controller_resolver')
Expand Down Expand Up @@ -316,19 +309,6 @@ private function addConnectionsSection(ArrayNodeDefinition $rootNode): void
->booleanNode('retryWrites')->end()
->scalarNode('w')->end()
->integerNode('wTimeoutMS')->end()
// Deprecated options
->booleanNode('fsync')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "fsync" is deprecated. Use "journal" option instead.')
->end()
->booleanNode('slaveOkay')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "slaveOkay" is deprecated. Use "readPreference" option instead.')
->end()
->integerNode('timeout')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "timeout" is deprecated. Use "connectTimeoutMS" option instead.')
->end()
->integerNode('wTimeout')
->setDeprecated('doctrine/mongodb-odm-bundle', '4.7', 'Option "wTimeout" is deprecated. Use "wTimeoutMS" option instead.')
->end()
->end()
->validate()
->ifTrue(static function ($v): bool {
Expand Down
7 changes: 0 additions & 7 deletions Resources/config/schema/mongodb-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
</xsd:complexType>

<xsd:complexType name="default-commit-options">
<xsd:attribute name="fsync" type="xsd:boolean" />
<xsd:attribute name="j" type="xsd:boolean" />
<xsd:attribute name="safe" type="xsd:string" />
<xsd:attribute name="timeout" type="xsd:integer" />
<xsd:attribute name="w" type="xsd:string" />
<xsd:attribute name="wtimeout" type="xsd:integer" />
Expand Down Expand Up @@ -83,11 +81,6 @@
<xsd:attribute name="retryWrites" type="xsd:boolean" />
<xsd:attribute name="w" type="xsd:string" />
<xsd:attribute name="wTimeoutMS" type="xsd:integer" />
<!-- deprecated options -->
<xsd:attribute name="fsync" type="xsd:boolean" />
<xsd:attribute name="slaveOkay" type="xsd:boolean" />
<xsd:attribute name="timeout" type="xsd:integer" />
<xsd:attribute name="wTimeout" type="xsd:integer" />
</xsd:complexType>

<xsd:complexType name="connection-driver-options">
Expand Down
10 changes: 2 additions & 8 deletions Tests/DependencyInjection/ConfigurationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,7 @@ public function testDefaults(): void
$this->assertEquals($defaults, $options);
}

/**
* @dataProvider provideFullConfiguration
* @group legacy
*/
/** @dataProvider provideFullConfiguration */
public function testFullConfiguration(array $config): void
{
$processor = new Processor();
Expand All @@ -86,8 +83,6 @@ public function testFullConfiguration(array $config): void
'timeout' => 10,
'w' => 'majority',
'wtimeout' => 10,
'fsync' => false,
'safe' => 2,
],
'connections' => [
'conn1' => [
Expand All @@ -104,7 +99,6 @@ public function testFullConfiguration(array $config): void
[],
],
'replicaSet' => 'foo',
'slaveOkay' => true,
'socketTimeoutMS' => 1000,
'ssl' => true,
'tls' => true,
Expand Down Expand Up @@ -279,7 +273,7 @@ public static function provideMergeOptions(): array
// the "options" array is totally replaced
$cases[] = [
[
['connections' => ['default' => ['options' => ['timeout' => 2000]]]],
['connections' => ['default' => ['options' => ['socketTimeoutMS' => 2000]]]],
['connections' => ['default' => ['options' => ['username' => 'foo']]]],
],
['connections' => ['default' => ['options' => ['username' => 'foo']]]],
Expand Down
3 changes: 0 additions & 3 deletions Tests/DependencyInjection/Fixtures/config/xml/full.xml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@
timeout="10"
w="majority"
wtimeout="10"
fsync="false"
safe="2"
/>

<doctrine:connection id="conn1" server="mongodb://localhost">
Expand All @@ -39,7 +37,6 @@
password="password_val"
readPreference="secondaryPreferred"
replicaSet="foo"
slaveOkay="true"
socketTimeoutMS="1000"
ssl="true"
tls="true"
Expand Down
3 changes: 0 additions & 3 deletions Tests/DependencyInjection/Fixtures/config/yml/full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ doctrine_mongodb:
timeout: 10
w: majority
wtimeout: 10
fsync: false
safe: 2

connections:
conn1:
Expand All @@ -38,7 +36,6 @@ doctrine_mongodb:
- { dc: west }
- { }
replicaSet: foo
slaveOkay: true
socketTimeoutMS: 1000
ssl: true
tls: true
Expand Down
11 changes: 11 additions & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ UPGRADE FROM 4.x to 5.0

Remove all `doctrine_mongodb.odm.*` parameters.

Deprecated options have been removed:

| namespace | removed | replaced by |
|--------------------------|-------------|--------------------|
| `default_commit_options` | `fsync` | `j` |
| `default_commit_options` | `safe` | `w` |
| `connections.*.options` | `fsync` | `journal` |
| `connections.*.options` | `slaveOkay` | `readPreference` |
| `connections.*.options` | `timeout` | `connectTimeoutMS` |
| `connections.*.options` | `wTimeout` | `wTimeoutMS` |

## Fixtures

* Remove `--service` option from `doctrine:mongodb:fixtures:load` command
Expand Down

0 comments on commit 0281da7

Please sign in to comment.