19
19
* This class is part of Ubiquity
20
20
*
21
21
* @author jcheron <[email protected] >
22
- * @version 1.0.5
22
+ * @version 1.0.6
23
23
* @category ubiquity.dev
24
24
*
25
25
*/
@@ -167,12 +167,13 @@ public function _newAction($controller, $action, $parameters = null, $content =
167
167
if ($ classCode !== false ) {
168
168
$ fileContent = \implode ('' , $ classCode );
169
169
$ fileContent = \trim ($ fileContent );
170
+ $ ctrlName =ClassUtils::getClassSimpleName ($ controller );
170
171
if ($ createView ) {
171
- $ viewname = $ this ->_createViewOp (ClassUtils:: getClassSimpleName ( $ controller ) , $ action , $ theme );
172
+ $ viewname = $ this ->_createViewOp ($ ctrlName , $ action , $ theme );
172
173
$ content .= "\n\t\t\$this->loadView(' " . $ viewname . "'); \n" ;
173
174
$ msgContent .= "<br>Created view : <b> " . $ viewname . "</b> " ;
174
175
}
175
- $ routeAnnotation = $ this ->generateRouteAnnotation ($ routeInfo );
176
+ $ routeAnnotation = $ this ->generateRouteAnnotation ($ routeInfo, $ ctrlName , $ action );
176
177
177
178
if ($ routeAnnotation != '' ) {
178
179
$ msgContent .= $ this ->_addMessageForRouteCreation ($ routeInfo ["path " ]);
@@ -220,7 +221,12 @@ public function _newAction($controller, $action, $parameters = null, $content =
220
221
}
221
222
}
222
223
223
- protected function generateRouteAnnotation ($ routeInfo ) {
224
+ private function generateRouteName (string $ controllerName ,string $ action ){
225
+ $ ctrl =\str_ireplace ('controller ' ,'' ,$ controllerName );
226
+ return \ucfirst ($ ctrl ) . '. ' . $ action ;
227
+ }
228
+
229
+ protected function generateRouteAnnotation ($ routeInfo ,$ controllerName ,$ action ) {
224
230
if (\is_array ($ routeInfo )) {
225
231
$ name = 'route ' ;
226
232
$ path = $ routeInfo ['path ' ];
@@ -244,7 +250,7 @@ protected function generateRouteAnnotation($routeInfo) {
244
250
}
245
251
}
246
252
}
247
-
253
+ $ routeProperties [ ' name ' ]= $ this -> generateRouteName ( $ controllerName , $ action );
248
254
249
255
return CacheManager::getAnnotationsEngineInstance ()->getAnnotation ($ this ,$ name ,$ routeProperties )->asAnnotation ();
250
256
}
0 commit comments