@@ -73,25 +73,6 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
73
73
*/
74
74
protected $ enabledParameter ;
75
75
76
- /**
77
- * Naming pattern for the configuration service id, for example
78
- * 'doctrine.orm.%s_configuration'.
79
- */
80
- private string $ configurationPattern ;
81
-
82
- /**
83
- * Method name to call on the configuration service. This depends on the
84
- * Doctrine implementation. For example addEntityNamespace.
85
- */
86
- private string $ registerAliasMethodName ;
87
-
88
- /**
89
- * Map of alias to namespace.
90
- *
91
- * @var string[]
92
- */
93
- private array $ aliasMap ;
94
-
95
76
/**
96
77
* The $managerParameters is an ordered list of container parameters that could provide the
97
78
* name of the manager to register these namespaces and alias on. The first non-empty name
@@ -108,24 +89,32 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
108
89
* @param string|false $enabledParameter Service container parameter that must be
109
90
* present to enable the mapping. Set to false
110
91
* to not do any check, optional.
111
- * @param string $configurationPattern Pattern for the Configuration service name
112
- * @param string $registerAliasMethodName Name of Configuration class method to
113
- * register alias
92
+ * @param string $configurationPattern Pattern for the Configuration service name,
93
+ * for example 'doctrine.orm.%s_configuration'.
94
+ * @param string $registerAliasMethodName Method name to call on the configuration service. This
95
+ * depends on the Doctrine implementation.
96
+ * For example addEntityNamespace.
114
97
* @param string[] $aliasMap Map of alias to namespace
115
98
*/
116
- public function __construct (Definition |Reference $ driver , array $ namespaces , array $ managerParameters , string $ driverPattern , string |false $ enabledParameter = false , string $ configurationPattern = '' , string $ registerAliasMethodName = '' , array $ aliasMap = [])
117
- {
99
+ public function __construct (
100
+ Definition |Reference $ driver ,
101
+ array $ namespaces ,
102
+ array $ managerParameters ,
103
+ string $ driverPattern ,
104
+ string |false $ enabledParameter = false ,
105
+ private readonly string $ configurationPattern = '' ,
106
+ private readonly string $ registerAliasMethodName = '' ,
107
+ private readonly array $ aliasMap = [],
108
+ ) {
118
109
$ this ->driver = $ driver ;
119
110
$ this ->namespaces = $ namespaces ;
120
111
$ this ->managerParameters = $ managerParameters ;
121
112
$ this ->driverPattern = $ driverPattern ;
122
113
$ this ->enabledParameter = $ enabledParameter ;
123
- if (\count ($ aliasMap ) && (!$ configurationPattern || !$ registerAliasMethodName )) {
114
+
115
+ if ($ aliasMap && (!$ configurationPattern || !$ registerAliasMethodName )) {
124
116
throw new \InvalidArgumentException ('configurationPattern and registerAliasMethodName are required to register namespace alias. ' );
125
117
}
126
- $ this ->configurationPattern = $ configurationPattern ;
127
- $ this ->registerAliasMethodName = $ registerAliasMethodName ;
128
- $ this ->aliasMap = $ aliasMap ;
129
118
}
130
119
131
120
/**
0 commit comments