@@ -67,25 +67,6 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
6767 */
6868 protected string |false $ enabledParameter ;
6969
70- /**
71- * Naming pattern for the configuration service id, for example
72- * 'doctrine.orm.%s_configuration'.
73- */
74- private string $ configurationPattern ;
75-
76- /**
77- * Method name to call on the configuration service. This depends on the
78- * Doctrine implementation. For example addEntityNamespace.
79- */
80- private string $ registerAliasMethodName ;
81-
82- /**
83- * Map of alias to namespace.
84- *
85- * @var string[]
86- */
87- private array $ aliasMap ;
88-
8970 /**
9071 * The $managerParameters is an ordered list of container parameters that could provide the
9172 * name of the manager to register these namespaces and alias on. The first non-empty name
@@ -102,24 +83,32 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
10283 * @param string|false $enabledParameter Service container parameter that must be
10384 * present to enable the mapping. Set to false
10485 * to not do any check, optional.
105- * @param string $configurationPattern Pattern for the Configuration service name
106- * @param string $registerAliasMethodName Name of Configuration class method to
107- * register alias
86+ * @param string $configurationPattern Pattern for the Configuration service name,
87+ * for example 'doctrine.orm.%s_configuration'.
88+ * @param string $registerAliasMethodName Method name to call on the configuration service. This
89+ * depends on the Doctrine implementation.
90+ * For example addEntityNamespace.
10891 * @param string[] $aliasMap Map of alias to namespace
10992 */
110- public function __construct (Definition |Reference $ driver , array $ namespaces , array $ managerParameters , string $ driverPattern , string |false $ enabledParameter = false , string $ configurationPattern = '' , string $ registerAliasMethodName = '' , array $ aliasMap = [])
111- {
93+ public function __construct (
94+ Definition |Reference $ driver ,
95+ array $ namespaces ,
96+ array $ managerParameters ,
97+ string $ driverPattern ,
98+ string |false $ enabledParameter = false ,
99+ private readonly string $ configurationPattern = '' ,
100+ private readonly string $ registerAliasMethodName = '' ,
101+ private readonly array $ aliasMap = [],
102+ ) {
112103 $ this ->driver = $ driver ;
113104 $ this ->namespaces = $ namespaces ;
114105 $ this ->managerParameters = $ managerParameters ;
115106 $ this ->driverPattern = $ driverPattern ;
116107 $ this ->enabledParameter = $ enabledParameter ;
117- if (\count ($ aliasMap ) && (!$ configurationPattern || !$ registerAliasMethodName )) {
108+
109+ if ($ aliasMap && (!$ configurationPattern || !$ registerAliasMethodName )) {
118110 throw new \InvalidArgumentException ('configurationPattern and registerAliasMethodName are required to register namespace alias. ' );
119111 }
120- $ this ->configurationPattern = $ configurationPattern ;
121- $ this ->registerAliasMethodName = $ registerAliasMethodName ;
122- $ this ->aliasMap = $ aliasMap ;
123112 }
124113
125114 /**
0 commit comments