@@ -73,6 +73,13 @@ public function configureCommand(Command $command, InputConfiguration $inputConf
7373 'Add a command bus dependency. ' ,
7474 null
7575 )
76+ ->addOption (
77+ 'base-path ' ,
78+ null ,
79+ InputOption::VALUE_REQUIRED ,
80+ 'Base path from which to generate model & config. ' ,
81+ null
82+ )
7683 ;
7784 }
7885
@@ -103,16 +110,26 @@ public function interact(InputInterface $input, ConsoleStyle $io, Command $comma
103110 );
104111 $ input ->setOption ('include-command-bus ' , $ includeCommandBus );
105112 }
113+
114+ if (null === $ input ->getOption ('base-path ' )) {
115+ $ basePath = $ io ->ask (
116+ 'Which base path should be used? Default is " ' . PathGenerator::DEFAULT_BASE_PATH . '" ' ,
117+ PathGenerator::DEFAULT_BASE_PATH ,
118+ );
119+ $ input ->setOption ('base-path ' , $ basePath );
120+ }
106121 }
107122
108123 /**
109124 * @inheritDoc
110125 */
111126 public function generate (InputInterface $ input , ConsoleStyle $ io , Generator $ generator ): void
112127 {
128+ $ pathGenerator = new PathGenerator ($ input ->getOption ('base-path ' ));
129+
113130 $ classNameDetails = $ generator ->createClassNameDetails (
114131 $ input ->getArgument ('name ' ),
115- self ::NAMESPACE_PREFIX ,
132+ $ pathGenerator -> namespacePrefix ( self ::NAMESPACE_PREFIX ) ,
116133 'Controller ' ,
117134 );
118135
@@ -155,7 +172,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
155172 self ::CONFIG_PATH ,
156173 $ templatePathConfig ,
157174 [
158- 'path ' => '../../src/Infrastructure/Http/Controller/ ' ,
175+ 'path ' => $ pathGenerator -> path ( '../../src/ ' , ' Infrastructure/Http/Controller/ ') ,
159176 'namespace ' => str_replace ('\\' . $ classNameDetails ->getShortName (), '' , $ classNameDetails ->getFullName ())
160177 ]
161178 );
0 commit comments