@@ -96,33 +96,67 @@ private function loadRoutes( string $configPath ): array
9696 {
9797 $ routes = [];
9898
99- // Load neuron.yaml configuration
100- $ configFile = $ configPath . '/neuron.yaml ' ;
99+ // Try routing.yaml first (new location), fall back to neuron.yaml (legacy)
100+ $ routingFile = $ configPath . '/routing.yaml ' ;
101+ $ neuronFile = $ configPath . '/neuron.yaml ' ;
101102
102- if ( !file_exists ( $ configFile ) )
103+ $ configFile = null ;
104+ $ configKey = null ;
105+
106+ if ( file_exists ( $ routingFile ) )
107+ {
108+ $ configFile = $ routingFile ;
109+ $ configKey = 'controller_paths ' ;
110+ }
111+ elseif ( file_exists ( $ neuronFile ) )
103112 {
104- $ this ->output ->error ( 'Configuration file not found: ' . $ configFile );
113+ $ configFile = $ neuronFile ;
114+ $ configKey = 'controllers.paths ' ;
115+ }
116+ else
117+ {
118+ $ this ->output ->error ( 'Configuration file not found ' );
119+ $ this ->output ->info ( 'Expected: ' . $ routingFile . ' or ' . $ neuronFile );
105120 return [];
106121 }
107122
108123 try
109124 {
110125 $ settings = new Yaml ( $ configFile );
111126
112- // Get base path
113- $ basePath = $ settings ->get ( 'system ' , 'base_path ' ) ?? dirname ( $ configPath );
127+ // Get base path from neuron.yaml
128+ $ neuronSettings = file_exists ( $ neuronFile ) ? new Yaml ( $ neuronFile ) : null ;
129+ $ basePath = $ neuronSettings ?->get( 'system ' , 'base_path ' ) ?? dirname ( $ configPath );
114130
115131 // Get controller paths from configuration
116- $ controllerPathsConfig = $ settings ->get ( 'controllers ' , 'paths ' );
132+ if ( $ configKey === 'controller_paths ' )
133+ {
134+ // New format in routing.yaml
135+ $ controllerPathsConfig = $ settings ->getSection ( 'controller_paths ' );
136+ }
137+ else
138+ {
139+ // Legacy format in neuron.yaml
140+ $ controllerPathsConfig = $ settings ->get ( 'controllers ' , 'paths ' );
141+ }
117142
118143 if ( empty ( $ controllerPathsConfig ) )
119144 {
120- $ this ->output ->warning ( 'No controller paths configured in neuron.yaml ' );
121- $ this ->output ->info ( 'Add controller paths to neuron.yaml under controllers.paths: ' );
122- $ this ->output ->info ( ' controllers: ' );
123- $ this ->output ->info ( ' paths: ' );
124- $ this ->output ->info ( ' - path: app/Controllers ' );
125- $ this ->output ->info ( ' namespace: App \\Controllers ' );
145+ $ this ->output ->warning ( 'No controller paths configured ' );
146+ $ this ->output ->info ( 'Add controller paths to ' . basename ( $ configFile ) . ': ' );
147+ if ( $ configKey === 'controller_paths ' )
148+ {
149+ $ this ->output ->info ( ' controller_paths: ' );
150+ $ this ->output ->info ( ' - path: app/Controllers ' );
151+ $ this ->output ->info ( ' namespace: App \\Controllers ' );
152+ }
153+ else
154+ {
155+ $ this ->output ->info ( ' controllers: ' );
156+ $ this ->output ->info ( ' paths: ' );
157+ $ this ->output ->info ( ' - path: app/Controllers ' );
158+ $ this ->output ->info ( ' namespace: App \\Controllers ' );
159+ }
126160 return [];
127161 }
128162
0 commit comments