Skip to content

Commit 867f3f6

Browse files
authored
Merge pull request #2004 from greg0ire/no-commented
Remove deprecated configuration nodes
2 parents 551a0e2 + d199c26 commit 867f3f6

File tree

5 files changed

+29
-72
lines changed

5 files changed

+29
-72
lines changed

UPGRADE-3.0.md

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,21 @@ Use `doctrine.dbal.default_table_options.collation` instead.
6464

6565
There is no replacement for this option.
6666

67+
### The `doctrine.dbal.types.some_custom_type.commented` option is removed
68+
69+
The `commented` option for custom types is no longer supported and has been
70+
removed.
71+
72+
### The `doctrine.dbal.connection.some_connection.platform_service` option is removed
73+
74+
The `platform_service` option for connections is no longer supported and has
75+
been removed.
76+
77+
### The `doctrine.dbal.connection.some_connection.keep_slave` and `doctrine.dbal.connection.some_connection.slaves` option is removed
78+
79+
`doctrine.dbal.connection.some_connection.slaves` becomes
80+
`doctrine.dbal.connection.some_connection.replicas`.
81+
6782
### Controller resolver auto mapping can no longer be configured
6883

6984
The `doctrine.orm.controller_resolver.auto_mapping` option now only accepts `false` as value, to disallow the usage of the controller resolver auto mapping feature by default. The configuration option will be fully removed in 4.0.
@@ -94,9 +109,3 @@ Type declarations
94109

95110
Native type declarations have been added to all constants, properties, and
96111
methods.
97-
98-
Types
99-
-----
100-
101-
* The `commented` configuration option for types is no longer supported and
102-
deprecated.

config/schema/doctrine-1.0.xsd

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@
2828
<xsd:attribute name="driver" type="xsd:string" />
2929
<xsd:attribute name="driver-class" type="xsd:string" />
3030
<xsd:attribute name="wrapper-class" type="xsd:string" />
31-
<xsd:attribute name="keep-slave" type="xsd:string" />
3231
<xsd:attribute name="keep-replica" type="xsd:string" />
33-
<xsd:attribute name="platform-service" type="xsd:string" />
3432
<xsd:attribute name="auto-commit" type="xsd:string" />
3533
<xsd:attribute name="schema-filter" type="xsd:string" />
3634
<xsd:attribute name="logging" type="xsd:string" default="false" />
@@ -81,7 +79,6 @@
8179
<xsd:choice>
8280
<xsd:element name="option" type="option" />
8381
<xsd:element name="mapping-type" type="named_scalar" />
84-
<xsd:element name="slave" type="replica" />
8582
<xsd:element name="replica" type="replica" />
8683
<xsd:element name="default-table-option" type="named_scalar" />
8784
</xsd:choice>

docs/en/configuration.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,6 @@ Configuration Reference
417417
MultipleActiveResultSets=""
418418
use-savepoints="true"
419419
driver="pdo_mysql"
420-
platform-service=""
421420
auto-commit=""
422421
schema-filter=""
423422
logging="%kernel.debug%"
@@ -944,7 +943,6 @@ can configure. The following block shows all possible configuration keys:
944943
wrapper-class="MyDoctrineDbalConnectionWrapper"
945944
charset=""
946945
logging="%kernel.debug%"
947-
platform-service="MyOwnDatabasePlatformService"
948946
auto-commit="false"
949947
schema-filter="^sf2_"
950948
>

src/DependencyInjection/Configuration.php

Lines changed: 3 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,6 @@ private function addDbalSection(ArrayNodeDefinition $node): void
114114
->end()
115115
->children()
116116
->scalarNode('class')->isRequired()->end()
117-
->booleanNode('commented')
118-
->setDeprecated(
119-
'doctrine/doctrine-bundle',
120-
'2.0',
121-
'The doctrine-bundle type commenting features were removed; the corresponding config parameter was deprecated in 2.0 and will be dropped in 3.0.',
122-
)
123-
->end()
124117
->end()
125118
->end()
126119
->end()
@@ -178,18 +171,10 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
178171
$connectionNode
179172
->fixXmlConfig('option')
180173
->fixXmlConfig('mapping_type')
181-
->fixXmlConfig('slave')
182174
->fixXmlConfig('replica')
183175
->fixXmlConfig('default_table_option')
184176
->children()
185177
->scalarNode('driver')->defaultValue('pdo_mysql')->end()
186-
->scalarNode('platform_service')
187-
->setDeprecated(
188-
'doctrine/doctrine-bundle',
189-
'2.9',
190-
'The "platform_service" configuration key is deprecated since doctrine-bundle 2.9. DBAL 4 will not support setting a custom platform via connection params anymore.',
191-
)
192-
->end()
193178
->booleanNode('auto_commit')->end()
194179
->scalarNode('schema_filter')->end()
195180
->booleanNode('logging')->defaultValue($this->debug)->end()
@@ -207,13 +192,6 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
207192
->integerNode('idle_connection_ttl')->defaultValue(600)->end()
208193
->scalarNode('driver_class')->end()
209194
->scalarNode('wrapper_class')->end()
210-
->booleanNode('keep_slave')
211-
->setDeprecated(
212-
'doctrine/doctrine-bundle',
213-
'2.2',
214-
'The "keep_slave" configuration key is deprecated since doctrine-bundle 2.2. Use the "keep_replica" configuration key instead.',
215-
)
216-
->end()
217195
->booleanNode('keep_replica')->end()
218196
->arrayNode('options')
219197
->useAttributeAsKey('key')
@@ -237,27 +215,14 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
237215
->scalarNode('result_cache')->end()
238216
->end();
239217

240-
// dbal < 2.11
241-
$slaveNode = $connectionNode
242-
->children()
243-
->arrayNode('slaves')
244-
->setDeprecated(
245-
'doctrine/doctrine-bundle',
246-
'2.2',
247-
'The "slaves" configuration key will be renamed to "replicas" in doctrine-bundle 3.0. "slaves" is deprecated since doctrine-bundle 2.2.',
248-
)
249-
->useAttributeAsKey('name')
250-
->prototype('array');
251-
/* @phpstan-ignore argument.type (symfony plugin needed) */
252-
$this->configureDbalDriverNode($slaveNode);
253-
254-
// dbal >= 2.11
255218
$replicaNode = $connectionNode
256219
->children()
257220
->arrayNode('replicas')
258221
->useAttributeAsKey('name')
259222
->prototype('array');
260-
/* @phpstan-ignore argument.type (symfony plugin needed) */
223+
224+
assert($replicaNode instanceof ArrayNodeDefinition);
225+
261226
$this->configureDbalDriverNode($replicaNode);
262227

263228
assert($node instanceof ArrayNodeDefinition);

src/DependencyInjection/DoctrineExtension.php

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -341,15 +341,8 @@ protected function getConnectionOptions(array $connection): array
341341

342342
$options += $connectionDefaults;
343343

344-
foreach (['replicas', 'slaves'] as $connectionKey) {
345-
foreach (array_keys($options[$connectionKey]) as $name) {
346-
$options[$connectionKey][$name] += $connectionDefaults;
347-
}
348-
}
349-
350-
if (isset($options['platform_service'])) {
351-
$options['platform'] = new Reference($options['platform_service']);
352-
unset($options['platform_service']);
344+
foreach (array_keys($options['replicas']) as $name) {
345+
$options['replicas'][$name] += $connectionDefaults;
353346
}
354347

355348
unset($options['mapping_types']);
@@ -359,7 +352,6 @@ protected function getConnectionOptions(array $connection): array
359352
'options' => 'driverOptions',
360353
'driver_class' => 'driverClass',
361354
'wrapper_class' => 'wrapperClass',
362-
'keep_slave' => 'keepReplica',
363355
'keep_replica' => 'keepReplica',
364356
'replicas' => 'replica',
365357
'server_version' => 'serverVersion',
@@ -374,27 +366,23 @@ protected function getConnectionOptions(array $connection): array
374366
unset($options[$old]);
375367
}
376368

377-
foreach (['replica', 'slaves'] as $connectionKey) {
378-
foreach ($options[$connectionKey] as $name => $value) {
379-
$driverOptions = $value['driverOptions'] ?? [];
380-
$parentDriverOptions = $options['driverOptions'] ?? [];
381-
if ($driverOptions === [] && $parentDriverOptions === []) {
382-
continue;
383-
}
384-
385-
$options[$connectionKey][$name]['driverOptions'] = $driverOptions + $parentDriverOptions;
369+
foreach ($options['replica'] as $name => $value) {
370+
$driverOptions = $value['driverOptions'] ?? [];
371+
$parentDriverOptions = $options['driverOptions'] ?? [];
372+
if ($driverOptions === [] && $parentDriverOptions === []) {
373+
continue;
386374
}
375+
376+
$options['replica'][$name]['driverOptions'] = $driverOptions + $parentDriverOptions;
387377
}
388378

389-
if (! empty($options['slaves']) || ! empty($options['replica'])) {
379+
if (! empty($options['replica'])) {
390380
$nonRewrittenKeys = [
391381
'driver' => true,
392382
'driverClass' => true,
393383
'wrapperClass' => true,
394-
'keepSlave' => true,
395384
'keepReplica' => true,
396385
'platform' => true,
397-
'slaves' => true,
398386
'primary' => true,
399387
'replica' => true,
400388
'serverVersion' => true,
@@ -419,7 +407,7 @@ protected function getConnectionOptions(array $connection): array
419407
$options['wrapperClass'] = PrimaryReadReplicaConnection::class;
420408
}
421409
} else {
422-
unset($options['slaves'], $options['replica']);
410+
unset($options['replica']);
423411
}
424412

425413
return $options;

0 commit comments

Comments
 (0)