1212use PackageFactory \AtomicFusion \PresentationObjects \Domain \Enum \EnumGenerator ;
1313use PackageFactory \AtomicFusion \PresentationObjects \Domain \PackageKey ;
1414use PackageFactory \AtomicFusion \PresentationObjects \Domain \PackageResolver ;
15+ use PackageFactory \AtomicFusion \PresentationObjects \Infrastructure \DefensiveConfirmationFileWriter ;
1516
1617/**
1718 * The command controller for kick-starting PresentationObject components
@@ -25,16 +26,10 @@ class ComponentCommandController extends CommandController
2526 protected $ packageResolver ;
2627
2728 /**
28- * @Flow\Inject
29- * @var ComponentGenerator
30- */
31- protected $ componentGenerator ;
32-
33- /**
34- * @Flow\Inject
35- * @var EnumGenerator
29+ * @Flow\InjectConfiguration(path="componentGeneration.colocate")
30+ * @var bool
3631 */
37- protected $ valueGenerator ;
32+ protected $ colocate ;
3833
3934 /**
4035 * Create a new PresentationObject component and factory
@@ -50,6 +45,7 @@ class ComponentCommandController extends CommandController
5045 * The following values are allowed for types:
5146 *
5247 * * string, int, float, bool
48+ * * slot
5349 * * Value class names created with <u>component:kickstartvalue</u> in the same
5450 * component namespace
5551 * * Component class names created with <u>component:kickstart</u> in the same
@@ -60,19 +56,24 @@ class ComponentCommandController extends CommandController
6056 *
6157 * @param string $name The name of the new component
6258 * @param bool $listable If set, an additional list type will be generated
59+ * @param bool $yes If set, no confirmation is going to be required for overwriting files
6360 * @return void
6461 * @throws \Neos\Utility\Exception\FilesException
6562 */
66- public function kickStartCommand (string $ name , bool $ listable = false ): void
63+ public function kickStartCommand (string $ name , bool $ listable = false , bool $ yes = false ): void
6764 {
65+ $ componentGenerator = new ComponentGenerator (
66+ new DefensiveConfirmationFileWriter ($ this ->output , $ yes )
67+ );
6868 $ package = $ this ->packageResolver ->resolvePackage ();
69- $ component = ComponentName::fromInput ($ name , PackageKey::fromPackage ($ package ));
70- $ componentPackage = $ this ->packageResolver ->resolvePackage ((string )$ component ->getPackageKey ());
69+ $ componentName = ComponentName::fromInput ($ name , PackageKey::fromPackage ($ package ));
70+ $ componentPackage = $ this ->packageResolver ->resolvePackage ((string )$ componentName ->getPackageKey ());
7171
72- $ this -> componentGenerator ->generateComponent (
73- $ component ,
72+ $ componentGenerator ->generateComponent (
73+ $ componentName ,
7474 $ this ->request ->getExceedingArguments (),
7575 $ componentPackage ->getPackagePath (),
76+ $ this ->colocate ,
7677 $ listable
7778 );
7879 }
@@ -92,20 +93,26 @@ public function kickStartCommand(string $name, bool $listable = false): void
9293 * @param string $name The name of the new pseudo-enum
9394 * @param string $type The type of the new pseudo-enum (must be one of: "string", "int")
9495 * @param array|string[] $values A comma-separated colon list of names:values for the new pseudo-enum, e.g. a,b,c , a:1,b:2,c:3 or a:1.2,b:2.4,c:3.6
96+ * @param bool $yes If set, no confirmation is going to be required for overwriting files
9597 * @return void
9698 */
97- public function kickStartEnumCommand (string $ componentName , string $ name , string $ type , array $ values = []): void
99+ public function kickStartEnumCommand (string $ componentName , string $ name , string $ type , array $ values = [], bool $ yes = false ): void
98100 {
101+ $ enumGenerator = new EnumGenerator (
102+ new \DateTimeImmutable (),
103+ new DefensiveConfirmationFileWriter ($ this ->output , $ yes )
104+ );
99105 $ package = $ this ->packageResolver ->resolvePackage ();
100- $ component = ComponentName::fromInput ($ componentName , PackageKey::fromPackage ($ package ));
101- $ componentPackage = $ this ->packageResolver ->resolvePackage ((string )$ component ->getPackageKey ());
106+ $ componentNameObject = ComponentName::fromInput ($ componentName , PackageKey::fromPackage ($ package ));
107+ $ componentPackage = $ this ->packageResolver ->resolvePackage ((string )$ componentNameObject ->getPackageKey ());
102108
103- $ this -> valueGenerator ->generateEnum (
104- $ component ,
109+ $ enumGenerator ->generateEnum (
110+ $ componentNameObject ,
105111 $ name ,
106112 $ type ,
107113 $ values ,
108- $ componentPackage ->getPackagePath ()
114+ $ componentPackage ->getPackagePath (),
115+ $ this ->colocate
109116 );
110117 }
111118}
0 commit comments