@@ -73,25 +73,6 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
7373 */
7474 protected $ enabledParameter ;
7575
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-
9576 /**
9677 * The $managerParameters is an ordered list of container parameters that could provide the
9778 * 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
10889 * @param string|false $enabledParameter Service container parameter that must be
10990 * present to enable the mapping. Set to false
11091 * 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.
11497 * @param string[] $aliasMap Map of alias to namespace
11598 */
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+ ) {
118109 $ this ->driver = $ driver ;
119110 $ this ->namespaces = $ namespaces ;
120111 $ this ->managerParameters = $ managerParameters ;
121112 $ this ->driverPattern = $ driverPattern ;
122113 $ this ->enabledParameter = $ enabledParameter ;
123- if (\count ($ aliasMap ) && (!$ configurationPattern || !$ registerAliasMethodName )) {
114+
115+ if ($ aliasMap && (!$ configurationPattern || !$ registerAliasMethodName )) {
124116 throw new \InvalidArgumentException ('configurationPattern and registerAliasMethodName are required to register namespace alias. ' );
125117 }
126- $ this ->configurationPattern = $ configurationPattern ;
127- $ this ->registerAliasMethodName = $ registerAliasMethodName ;
128- $ this ->aliasMap = $ aliasMap ;
129118 }
130119
131120 /**
0 commit comments