@@ -24,7 +24,8 @@ protected function configure()
2424 $ this
2525 ->setDefinition (array (
2626 new InputOption ('module ' ,'' ,InputOption::VALUE_REQUIRED , 'The name of the module ' ),
27- new InputOption ('entity ' ,'' ,InputOption::VALUE_REQUIRED , 'The name of the entity ' )
27+ new InputOption ('entity ' ,'' ,InputOption::VALUE_REQUIRED , 'The name of the entity ' ),
28+ new InputOption ('class ' ,'' ,InputOption::VALUE_REQUIRED , 'The class of the entity ' )
2829 ))
2930 ->setName ('generate:entity ' )
3031 ->setDescription ('Generate entity ' )
@@ -37,10 +38,11 @@ protected function execute(InputInterface $input, OutputInterface $output)
3738
3839 $ module = $ input ->getOption ('module ' );
3940 $ entity = $ input ->getOption ('entity ' );
40-
41+ $ class = $ input ->getOption ('class ' );
42+
4143 $ this
4244 ->getGenerator ()
43- ->generate ($ module , $ entity );
45+ ->generate ($ module , $ entity, $ class );
4446
4547 $ errors = [];
4648 $ dialog ->writeGeneratorSummary ($ output , $ errors );
@@ -73,6 +75,26 @@ protected function interact(InputInterface $input, OutputInterface $output)
7375 }
7476 $ input ->setOption ('entity ' , $ entity );
7577
78+ // --entity option
79+ $ entity = $ input ->getOption ('entity ' );
80+ if (!$ entity ) {
81+ $ entity = $ dialog ->ask (
82+ $ output ,
83+ $ dialog ->getQuestion ('Enter the entity name ' , '' )
84+ );
85+ }
86+ $ input ->setOption ('entity ' , $ entity );
87+
88+ // --class option
89+ $ class = $ input ->getOption ('class ' );
90+ if (!$ class ) {
91+ $ class = $ dialog ->askConfirmation (
92+ $ output ,
93+ $ dialog ->getQuestion ('Enter the class of the entity ' , 'ConfigEntityType ' , '? ' ),
94+ true
95+ );
96+ }
97+ $ input ->setOption ('class ' , $ class );
7698 }
7799
78100
0 commit comments