File tree Expand file tree Collapse file tree 4 files changed +14
-11
lines changed
Expand file tree Collapse file tree 4 files changed +14
-11
lines changed Original file line number Diff line number Diff line change 44- Added trailing semicolon to scaffolding crud views getters [ #1477 ] ( https://github.com/phalcon/phalcon-devtools/issues/1477 )
55- Fixed optional options (namespace, abstract) checks on model create [ #1491 ] ( https://github.com/phalcon/phalcon-devtools/issues/1491 )
66- Fixed wrong request filtering [ #1468 ] ( https://github.com/phalcon/phalcon-devtools/issues/1468 )
7+ - Fixed empty namespace generation [ #1467 ] ( https://github.com/phalcon/phalcon-devtools/issues/1467 )
78
89# [ 4.0.5] ( https://github.com/phalcon/cphalcon/releases/tag/v4.0.5 ) (2021-03-14)
910## Fixed
Original file line number Diff line number Diff line change @@ -103,12 +103,14 @@ public function build()
103103 */
104104 protected function constructNamespace (): string
105105 {
106- $ namespace = $ this ->options ->get ('namespace ' );
106+ $ namespace = $ this ->options ->has ('namespace ' )
107+ ? (string ) $ this ->options ->get ('namespace ' ) : null ;
108+
107109 if ($ namespace === null ) {
108110 return '' ;
109111 }
110112
111- if ($ this ->checkNamespace (( string ) $ namespace )) {
113+ if ($ this ->checkNamespace ($ namespace ) && ! empty ( trim ( $ namespace) )) {
112114 return 'namespace ' . $ this ->options ->get ('namespace ' ) . '; ' . PHP_EOL . PHP_EOL ;
113115 }
114116
Original file line number Diff line number Diff line change @@ -111,9 +111,10 @@ public function build(): void
111111 require_once $ config ->devtools ->loader ;
112112 }
113113
114- $ namespace = '' ;
115- if ($ this ->modelOptions ->hasOption ('namespace ' ) &&
116- $ this ->checkNamespace ((string )$ this ->modelOptions ->getOption ('namespace ' ))) {
114+ $ namespace = $ this ->modelOptions ->hasOption ('namespace ' )
115+ ? (string ) $ this ->modelOptions ->getOption ('namespace ' ) : '' ;
116+
117+ if ($ this ->checkNamespace ($ namespace ) && !empty (trim ($ namespace ))) {
117118 $ namespace = 'namespace ' . $ this ->modelOptions ->getOption ('namespace ' ) . '; ' . PHP_EOL . PHP_EOL ;
118119 }
119120
Original file line number Diff line number Diff line change @@ -459,14 +459,13 @@ private function makeController(): void
459459 $ code = file_get_contents ($ this ->options ->get ('templatePath ' ) . '/scaffold/no-forms/Controller.php ' );
460460 $ usesNamespaces = false ;
461461
462- $ controllerNamespace = (string )$ this ->options ->get ('controllersNamespace ' );
463- if ($ this ->options ->has ('controllersNamespace ' ) &&
464- $ controllerNamespace &&
465- $ this ->checkNamespace ($ controllerNamespace )
466- ) {
462+ $ controllerNamespace = $ this ->options ->has ('controllersNamespace ' )
463+ ? (string ) $ this ->options ->get ('controllersNamespace ' ) : '' ;
464+
465+ if (!empty (trim ($ controllerNamespace )) && $ this ->checkNamespace ($ controllerNamespace )) {
467466 $ code = str_replace (
468467 '$namespace$ ' ,
469- 'namespace ' . $ this -> options -> get ( ' controllersNamespace ' ) .'; ' . PHP_EOL ,
468+ 'namespace ' . $ controllerNamespace .'; ' . PHP_EOL ,
470469 $ code
471470 );
472471 $ usesNamespaces = true ;
You can’t perform that action at this time.
0 commit comments