32
32
*/
33
33
abstract class RegisterMappingsPass implements CompilerPassInterface
34
34
{
35
- /**
36
- * DI object for the driver to use, either a service definition for a
37
- * private service or a reference for a public service.
38
- */
39
- protected Definition |Reference $ driver ;
40
-
41
- /**
42
- * List of namespaces handled by the driver.
43
- *
44
- * @var string[]
45
- */
46
- protected array $ namespaces ;
47
-
48
- /**
49
- * List of potential container parameters that hold the object manager name
50
- * to register the mappings with the correct metadata driver, for example
51
- * ['acme.manager', 'doctrine.default_entity_manager'].
52
- *
53
- * @var string[]
54
- */
55
- protected array $ managerParameters ;
56
-
57
- /**
58
- * Naming pattern of the metadata chain driver service ids, for example
59
- * 'doctrine.orm.%s_metadata_driver'.
60
- */
61
- protected string $ driverPattern ;
62
-
63
- /**
64
- * A name for a parameter in the container. If set, this compiler pass will
65
- * only do anything if the parameter is present. (But regardless of the
66
- * value of that parameter.
67
- */
68
- protected string |false $ enabledParameter ;
69
-
70
35
/**
71
36
* The $managerParameters is an ordered list of container parameters that could provide the
72
37
* name of the manager to register these namespaces and alias on. The first non-empty name
@@ -79,10 +44,10 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
79
44
* @param string[] $namespaces List of namespaces handled by $driver
80
45
* @param string[] $managerParameters list of container parameters that could
81
46
* hold the manager name
82
- * @param string $driverPattern Pattern for the metadata driver service name
47
+ * @param string $driverPattern Pattern for the metadata chain driver service ids (e.g. "doctrine.orm.%s_metadata_driver")
83
48
* @param string|false $enabledParameter Service container parameter that must be
84
- * present to enable the mapping. Set to false
85
- * to not do any check, optional .
49
+ * present to enable the mapping (regardless of the
50
+ * parameter value). Pass false to not do any check.
86
51
* @param string $configurationPattern Pattern for the Configuration service name,
87
52
* for example 'doctrine.orm.%s_configuration'.
88
53
* @param string $registerAliasMethodName Method name to call on the configuration service. This
@@ -91,21 +56,15 @@ abstract class RegisterMappingsPass implements CompilerPassInterface
91
56
* @param string[] $aliasMap Map of alias to namespace
92
57
*/
93
58
public function __construct (
94
- Definition |Reference $ driver ,
95
- array $ namespaces ,
96
- array $ managerParameters ,
97
- string $ driverPattern ,
98
- string |false $ enabledParameter = false ,
59
+ protected Definition |Reference $ driver ,
60
+ protected array $ namespaces ,
61
+ protected array $ managerParameters ,
62
+ protected string $ driverPattern ,
63
+ protected string |false $ enabledParameter = false ,
99
64
private readonly string $ configurationPattern = '' ,
100
65
private readonly string $ registerAliasMethodName = '' ,
101
66
private readonly array $ aliasMap = [],
102
67
) {
103
- $ this ->driver = $ driver ;
104
- $ this ->namespaces = $ namespaces ;
105
- $ this ->managerParameters = $ managerParameters ;
106
- $ this ->driverPattern = $ driverPattern ;
107
- $ this ->enabledParameter = $ enabledParameter ;
108
-
109
68
if ($ aliasMap && (!$ configurationPattern || !$ registerAliasMethodName )) {
110
69
throw new \InvalidArgumentException ('configurationPattern and registerAliasMethodName are required to register namespace alias. ' );
111
70
}
0 commit comments