16
16
use Laminas \ModuleManager \Listener \ServiceListener ;
17
17
18
18
/**
19
- * Native ServiceManagerConfig that replicates Laminas\Mvc\Service\ServiceManagerConfig
20
- * but without MVC dependencies - only the core service management functionality
19
+ * Native ServiceManagerConfig.
20
+ * Replicates the essential service management functionality while avoiding Laminas mvc dependencies.
21
21
*/
22
22
class MvcServiceManagerConfig
23
23
{
@@ -33,7 +33,7 @@ class MvcServiceManagerConfig
33
33
*/
34
34
public function __construct (array $ config = [])
35
35
{
36
- // Core configuration exactly matching original Laminas\Mvc\Service\ServiceManagerConfig
36
+ // Core configuration
37
37
$ this ->config = [
38
38
'abstract_factories ' => [],
39
39
'aliases ' => [
@@ -50,7 +50,7 @@ public function __construct(array $config = [])
50
50
'EventManager ' => function ($ container ) {
51
51
$ sharedManager = $ container ->has ('SharedEventManager ' ) ?
52
52
$ container ->get ('SharedEventManager ' ) : null ;
53
- return new \ Laminas \ EventManager \ EventManager ($ sharedManager );
53
+ return new EventManager ($ sharedManager );
54
54
},
55
55
'ModuleManager ' => ModuleManagerFactory::class,
56
56
'ServiceListener ' => ServiceListenerFactory::class,
@@ -64,17 +64,17 @@ public function __construct(array $config = [])
64
64
],
65
65
];
66
66
67
- // Add ServiceManager factory (same as original)
67
+ // Add ServiceManager factory
68
68
$ this ->config ['factories ' ]['ServiceManager ' ] = function ($ container ) {
69
69
return $ container ;
70
70
};
71
71
72
- // Add SharedEventManager factory (same as original)
72
+ // Add SharedEventManager factory
73
73
$ this ->config ['factories ' ]['SharedEventManager ' ] = function () {
74
- return new \ Laminas \ EventManager \ SharedEventManager ();
74
+ return new SharedEventManager ();
75
75
};
76
76
77
- // Add EventManagerAware initializer (same as original)
77
+ // Add EventManagerAware initializer
78
78
$ this ->config ['initializers ' ]['EventManagerAwareInitializer ' ] = function ($ container , $ instance ) {
79
79
if (!$ instance instanceof \Laminas \EventManager \EventManagerAwareInterface) {
80
80
return ;
@@ -96,30 +96,28 @@ public function __construct(array $config = [])
96
96
}
97
97
98
98
/**
99
- * Configure service manager (same API as Laminas\Mvc\Service\ServiceManagerConfig)
99
+ * Configure service manager
100
100
*
101
101
* @param ServiceManager $serviceManager
102
102
* @return ServiceManager
103
103
*/
104
104
public function configureServiceManager (ServiceManager $ serviceManager ): ServiceManager
105
105
{
106
- // Add ServiceManager service reference (same as Laminas)
106
+ // Add ServiceManager service reference
107
107
$ this ->config ['services ' ][ServiceManager::class] = $ serviceManager ;
108
108
109
- // Enable override during bootstrapping (same as Laminas)
109
+ // Enable override during bootstrapping
110
110
$ serviceManager ->setAllowOverride (true );
111
-
112
- // Configure the service manager using Laminas ServiceManager's native configure method
113
111
$ serviceManager ->configure ($ this ->config );
114
112
115
- // Disable override after configuration (same as Laminas)
113
+ // Disable override after configuration
116
114
$ serviceManager ->setAllowOverride (false );
117
115
118
116
return $ serviceManager ;
119
117
}
120
118
121
119
/**
122
- * Return all service configuration (same API as Laminas)
120
+ * Return all service configuration
123
121
*
124
122
* @return array
125
123
*/
0 commit comments