Skip to content

Commit 551a0e2

Browse files
authored
Merge pull request #2001 from greg0ire/disallow-conflicts
Disallow conflicts between url and standalone options
2 parents 0912525 + ff8ec1f commit 551a0e2

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

UPGRADE-3.0.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,12 @@ Auto mapping used any route parameter that matches with a field name of the Enti
7272

7373
If you were relying on this functionality, you will need to update your code to use explicit mapped route parameters instead.
7474

75+
### URL overrides are no longer allowed
76+
77+
When using the `doctrine.dbal.url` configuration option, you can no longer
78+
specify other configuration options that would conflict with it, such as
79+
`dbname`, `host`, etc.
80+
7581
ConnectionFactory::createConnection() signature change
7682
------------------------------------------------------
7783

docs/en/configuration.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ can configure. The following block shows all possible configuration keys:
823823
824824
doctrine:
825825
dbal:
826-
url: mysql://user:secret@localhost:1234/otherdatabase # this would override the values below
826+
url: mysql://user:secret@localhost:1234/otherdatabase
827827
dbname: database
828828
host: localhost
829829
port: 1234

src/DependencyInjection/Configuration.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Doctrine\ORM\Mapping\ClassMetadata;
88
use Doctrine\ORM\Mapping\ClassMetadataFactory;
99
use InvalidArgumentException;
10+
use RuntimeException;
1011
use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition;
1112
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
1213
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
@@ -30,7 +31,6 @@
3031
use function reset;
3132
use function sprintf;
3233
use function strtoupper;
33-
use function trigger_deprecation;
3434

3535
/**
3636
* This class contains the configuration information for the bundle
@@ -284,13 +284,12 @@ private function configureDbalDriverNode(ArrayNodeDefinition $node): void
284284

285285
if ($urlConflictingValues) {
286286
$tail = count($urlConflictingValues) > 1 ? sprintf('or "%s" options', array_pop($urlConflictingValues)) : 'option';
287-
trigger_deprecation(
288-
'doctrine/doctrine-bundle',
289-
'2.4',
290-
'Setting the "doctrine.dbal.%s" %s while the "url" one is defined is deprecated',
287+
288+
throw new RuntimeException(sprintf(
289+
'Setting the "doctrine.dbal.%s" %s while the "url" one is defined is not allowed.',
291290
implode('", "', $urlConflictingValues),
292291
$tail,
293-
);
292+
));
294293
}
295294

296295
return $values;

0 commit comments

Comments
 (0)