Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions UPGRADE-3.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,21 @@ Use `doctrine.dbal.default_table_options.collation` instead.

There is no replacement for this option.

### The `doctrine.dbal.types.some_custom_type.commented` option is removed

The `commented` option for custom types is no longer supported and has been
removed.

### The `doctrine.dbal.connection.some_connection.platform_service` option is removed

The `platform_service` option for connections is no longer supported and has
been removed.

### The `doctrine.dbal.connection.some_connection.keep_slave` and `doctrine.dbal.connection.some_connection.slaves` option is removed

`doctrine.dbal.connection.some_connection.slaves` becomes
`doctrine.dbal.connection.some_connection.replicas`.

### Controller resolver auto mapping can no longer be configured

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.
Expand Down Expand Up @@ -94,9 +109,3 @@ Type declarations

Native type declarations have been added to all constants, properties, and
methods.

Types
-----

* The `commented` configuration option for types is no longer supported and
deprecated.
3 changes: 0 additions & 3 deletions config/schema/doctrine-1.0.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
<xsd:attribute name="driver" type="xsd:string" />
<xsd:attribute name="driver-class" type="xsd:string" />
<xsd:attribute name="wrapper-class" type="xsd:string" />
<xsd:attribute name="keep-slave" type="xsd:string" />
<xsd:attribute name="keep-replica" type="xsd:string" />
<xsd:attribute name="platform-service" type="xsd:string" />
<xsd:attribute name="auto-commit" type="xsd:string" />
<xsd:attribute name="schema-filter" type="xsd:string" />
<xsd:attribute name="logging" type="xsd:string" default="false" />
Expand Down Expand Up @@ -81,7 +79,6 @@
<xsd:choice>
<xsd:element name="option" type="option" />
<xsd:element name="mapping-type" type="named_scalar" />
<xsd:element name="slave" type="replica" />
<xsd:element name="replica" type="replica" />
<xsd:element name="default-table-option" type="named_scalar" />
</xsd:choice>
Expand Down
2 changes: 0 additions & 2 deletions docs/en/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ Configuration Reference
MultipleActiveResultSets=""
use-savepoints="true"
driver="pdo_mysql"
platform-service=""
auto-commit=""
schema-filter=""
logging="%kernel.debug%"
Expand Down Expand Up @@ -944,7 +943,6 @@ can configure. The following block shows all possible configuration keys:
wrapper-class="MyDoctrineDbalConnectionWrapper"
charset=""
logging="%kernel.debug%"
platform-service="MyOwnDatabasePlatformService"
auto-commit="false"
schema-filter="^sf2_"
>
Expand Down
41 changes: 3 additions & 38 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ private function addDbalSection(ArrayNodeDefinition $node): void
->end()
->children()
->scalarNode('class')->isRequired()->end()
->booleanNode('commented')
->setDeprecated(
'doctrine/doctrine-bundle',
'2.0',
'The doctrine-bundle type commenting features were removed; the corresponding config parameter was deprecated in 2.0 and will be dropped in 3.0.',
)
->end()
->end()
->end()
->end()
Expand Down Expand Up @@ -178,18 +171,10 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
$connectionNode
->fixXmlConfig('option')
->fixXmlConfig('mapping_type')
->fixXmlConfig('slave')
->fixXmlConfig('replica')
->fixXmlConfig('default_table_option')
->children()
->scalarNode('driver')->defaultValue('pdo_mysql')->end()
->scalarNode('platform_service')
->setDeprecated(
'doctrine/doctrine-bundle',
'2.9',
'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.',
)
->end()
->booleanNode('auto_commit')->end()
->scalarNode('schema_filter')->end()
->booleanNode('logging')->defaultValue($this->debug)->end()
Expand All @@ -207,13 +192,6 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
->integerNode('idle_connection_ttl')->defaultValue(600)->end()
->scalarNode('driver_class')->end()
->scalarNode('wrapper_class')->end()
->booleanNode('keep_slave')
->setDeprecated(
'doctrine/doctrine-bundle',
'2.2',
'The "keep_slave" configuration key is deprecated since doctrine-bundle 2.2. Use the "keep_replica" configuration key instead.',
)
->end()
->booleanNode('keep_replica')->end()
->arrayNode('options')
->useAttributeAsKey('key')
Expand All @@ -237,27 +215,14 @@ private function getDbalConnectionsNode(): ArrayNodeDefinition
->scalarNode('result_cache')->end()
->end();

// dbal < 2.11
$slaveNode = $connectionNode
->children()
->arrayNode('slaves')
->setDeprecated(
'doctrine/doctrine-bundle',
'2.2',
'The "slaves" configuration key will be renamed to "replicas" in doctrine-bundle 3.0. "slaves" is deprecated since doctrine-bundle 2.2.',
)
->useAttributeAsKey('name')
->prototype('array');
/* @phpstan-ignore argument.type (symfony plugin needed) */
$this->configureDbalDriverNode($slaveNode);

// dbal >= 2.11
$replicaNode = $connectionNode
->children()
->arrayNode('replicas')
->useAttributeAsKey('name')
->prototype('array');
/* @phpstan-ignore argument.type (symfony plugin needed) */

assert($replicaNode instanceof ArrayNodeDefinition);

$this->configureDbalDriverNode($replicaNode);

assert($node instanceof ArrayNodeDefinition);
Expand Down
34 changes: 11 additions & 23 deletions src/DependencyInjection/DoctrineExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,8 @@ protected function getConnectionOptions(array $connection): array

$options += $connectionDefaults;

foreach (['replicas', 'slaves'] as $connectionKey) {
foreach (array_keys($options[$connectionKey]) as $name) {
$options[$connectionKey][$name] += $connectionDefaults;
}
}

if (isset($options['platform_service'])) {
$options['platform'] = new Reference($options['platform_service']);
unset($options['platform_service']);
foreach (array_keys($options['replicas']) as $name) {
$options['replicas'][$name] += $connectionDefaults;
}

unset($options['mapping_types']);
Expand All @@ -359,7 +352,6 @@ protected function getConnectionOptions(array $connection): array
'options' => 'driverOptions',
'driver_class' => 'driverClass',
'wrapper_class' => 'wrapperClass',
'keep_slave' => 'keepReplica',
'keep_replica' => 'keepReplica',
'replicas' => 'replica',
'server_version' => 'serverVersion',
Expand All @@ -374,27 +366,23 @@ protected function getConnectionOptions(array $connection): array
unset($options[$old]);
}

foreach (['replica', 'slaves'] as $connectionKey) {
foreach ($options[$connectionKey] as $name => $value) {
$driverOptions = $value['driverOptions'] ?? [];
$parentDriverOptions = $options['driverOptions'] ?? [];
if ($driverOptions === [] && $parentDriverOptions === []) {
continue;
}

$options[$connectionKey][$name]['driverOptions'] = $driverOptions + $parentDriverOptions;
foreach ($options['replica'] as $name => $value) {
$driverOptions = $value['driverOptions'] ?? [];
$parentDriverOptions = $options['driverOptions'] ?? [];
if ($driverOptions === [] && $parentDriverOptions === []) {
continue;
}

$options['replica'][$name]['driverOptions'] = $driverOptions + $parentDriverOptions;
}

if (! empty($options['slaves']) || ! empty($options['replica'])) {
if (! empty($options['replica'])) {
$nonRewrittenKeys = [
'driver' => true,
'driverClass' => true,
'wrapperClass' => true,
'keepSlave' => true,
'keepReplica' => true,
'platform' => true,
'slaves' => true,
'primary' => true,
'replica' => true,
'serverVersion' => true,
Expand All @@ -419,7 +407,7 @@ protected function getConnectionOptions(array $connection): array
$options['wrapperClass'] = PrimaryReadReplicaConnection::class;
}
} else {
unset($options['slaves'], $options['replica']);
unset($options['replica']);
}

return $options;
Expand Down