44 $restControllersDir = \ROOT . \DS . str_replace (
"\\", \DS,
$controllerNS );
45 UFileSystem::safeMkdir ( $restControllersDir );
48 if (! \file_exists ( $filename )) {
50 if(\class_exists(
'\\Ubiquity\\attributes\\AttributesEngine')){
51 $attrFolder=
'attributes/';
60 if ($this->routePath !=
null) {
62 $automatedAndInherited=$this->baseClass===RestBaseController::class;
63 $routeAnnot=$this->
getRouteAnnotation($this->routePath,$automatedAndInherited,$automatedAndInherited);
68 UFileSystem::openReplaceWriteFromTemplateFile ( $templateDir . $this->templateName, $filename, $variables );
69 $messages [] =
$scaffoldController->showSimpleMessage (
"The <b>" .
$controllerName .
"</b> Rest controller has been created in <b>" . UFileSystem::cleanPathname ( $filename ) .
"</b>.",
"success",
"Rest creation",
"checkmark circle", 30000,
"msgGlobal" );
70 if (isset ( $reInit )) {
71 $this->scaffoldController->initRestCache (
false );
74 $messages [] =
$scaffoldController->showSimpleMessage (
"The file <b>" . $filename .
"</b> already exists.<br>Can not create the <b>" .
$controllerName .
"</b> Rest controller!",
"warning",
"Rest error",
"warning circle", 30000,
"msgGlobal" );
76 $this->scaffoldController->_refreshRest (
true );
77 echo implode (
"\n", $messages );