File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -32,14 +32,19 @@ public static function create(array|string $settings): ContainerInterface
3232 $ autoWiresDefinitions = File::require ($ autoWiresPath , 'Auto wires file does not exist ' );
3333
3434 // 2. Crete container
35+ $ isAutoWiringEnabled = $ settingsArray ['di ' ]['auto_wires ' ]['enabled ' ];
3536 $ containerBuilder = ContainerBuilder::create ()
3637 ->addSettingsArray ($ settingsArray )
3738 ->addRootPath ($ settingsArray ['rootPath ' ])
3839 ->addRootNamespace ($ settingsArray ['rootNamespace ' ])
39- ->useAutoWiring ($ settingsArray [ ' di ' ][ ' auto_wires ' ][ ' enabled ' ] )
40+ ->useAutoWiring ($ isAutoWiringEnabled )
4041 ->useAttributes ($ settingsArray ['di ' ]['attributes ' ]['enabled ' ])
4142 ;
4243
44+ if ($ isAutoWiringEnabled ) {
45+ $ containerBuilder ->addDefinitions ($ autoWiresDefinitions );
46+ }
47+
4348 // 3. Cache
4449 if (Environment::from ($ settingsArray ['environment ' ]) === Environment::PRODUCTION ) {
4550 $ containerCachePath = $ settingsArray ['di ' ]['cache ' ]['container ' ]['path ' ];
@@ -48,7 +53,7 @@ public static function create(array|string $settings): ContainerInterface
4853 $ containerBuilder
4954 ->enableCompilation ($ containerCachePath )
5055 ->addResolverCachePathFile ($ resolverCachePathFile )
51- -> addDefinitions ( $ autoWiresDefinitions ) ;
56+ ;
5257 }
5358
5459 // 4. Add definitions
You can’t perform that action at this time.
0 commit comments