Skip to content

Commit 0406866

Browse files
feature #62792 [DoctrineBridge] Deprecate RegisterMappingsPass::$aliasMap (GromNaN)
This PR was merged into the 8.1 branch. Discussion ---------- [DoctrineBridge] Deprecate `RegisterMappingsPass::$aliasMap` | Q | A | ------------- | --- | Branch? | 8.1 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | - | License | MIT Namespace aliases have been deprecated from `doctrine/persistence` [2.3.0](https://github.com/doctrine/persistence/releases/tag/2.3.0) doctrine/persistence#204, and removed from [3.0.0](doctrine/persistence@7422aab#diff-65217b628918b27724f64d13ef152e91e8d5223c594e564f8583fb2045cb779f). - DoctrineBundle accepts this parameter, but the method `Configuration::addEntityNamespace` has been removed in `dotrine/orm` 3.0.0, which make it broken. Removing in doctrine/DoctrineMongoDBBundle#971 - DoctrineMongoDBBundle accepts them but the namespace alias support is no longer supported. Removing in doctrine/DoctrineBundle#2169 - DoctrinePHPCRBundle removed usage of this parameter in doctrine/DoctrinePHPCRBundle@dc82197 Projects using the child classes of `RegisterMappingPass` never set an `$aliasMap`. - [`FOSUserBundle`](https://github.com/FriendsOfSymfony/FOSUserBundle/blob/607a7fb975bc0c39bc2aa7e4ab8c52aded74d63c/src/FOSUserBundle.php#L46-L52) Removing this parameters is a breaking change but could be already done in 8.1 as it is unsupported or broken for all the Doctrine bundles. Commits ------- 4ecc888 [DoctrineBridge] Deprecate RegisterMappingsPass::$aliasMap, not supported by ORM and MongoDB ODM
2 parents ebb9ef0 + 4ecc888 commit 0406866

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

UPGRADE-8.1.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ DependencyInjection
66

77
* Deprecate configuring options `alias`, `parent`, `synthetic`, `file`, `arguments`, `properties`, `configurator` or `calls` when using `from_callable`
88

9+
DoctrineBridge
10+
--------------
11+
12+
* Deprecate setting an `$aliasMap` in `RegisterMappingsPass`. Namespace aliases are no longer supported in Doctrine.
13+
914
FrameworkBundle
1015
---------------
1116

src/Symfony/Bridge/Doctrine/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
8.1
5+
---
6+
7+
* Deprecate setting an `$aliasMap` in `RegisterMappingsPass`. Namespace aliases are no longer supported in Doctrine.
8+
49
8.0
510
---
611

src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ public function __construct(
6565
private readonly string $registerAliasMethodName = '',
6666
private readonly array $aliasMap = [],
6767
) {
68-
if ($aliasMap && (!$configurationPattern || !$registerAliasMethodName)) {
69-
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias.');
68+
if ($aliasMap) {
69+
trigger_deprecation('symfony/doctrine-bridge', '8.1', 'The property RegisterMappingsPass::$aliasMap is deprecated and will be removed in 9.0. Namespace alias are no longer supported.');
70+
71+
if (!$configurationPattern || !$registerAliasMethodName) {
72+
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias.');
73+
}
7074
}
7175
}
7276

@@ -103,7 +107,7 @@ public function process(ContainerBuilder $container): void
103107
* Get the service name of the metadata chain driver that the mappings
104108
* should be registered with.
105109
*
106-
* @throws InvalidArgumentException if non of the managerParameters has a
110+
* @throws InvalidArgumentException if none of the managerParameters has a
107111
* non-empty value
108112
*/
109113
protected function getChainDriverServiceName(ContainerBuilder $container): string

src/Symfony/Bridge/Doctrine/composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"php": ">=8.4",
2020
"doctrine/event-manager": "^2",
2121
"doctrine/persistence": "^3.1|^4",
22+
"symfony/deprecation-contracts": "^2.5|^3",
2223
"symfony/polyfill-ctype": "^1.8",
2324
"symfony/polyfill-mbstring": "^1.0",
2425
"symfony/service-contracts": "^2.5|^3"

0 commit comments

Comments
 (0)