3 namespace Drupal\woot\Generators;
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
10 class ExampleGenerator extends BaseGenerator
12 protected $name = 'woot-example';
13 protected $description = 'Generates a woot.';
14 protected $alias = 'wootex';
15 protected $templatePath = __DIR__;
17 // We don't actually use this service. This illustrates how to inject a dependency into a Generator.
18 protected $moduleHandler;
20 public function __construct($moduleHandler = null, $name = null)
22 parent::__construct($name);
23 $this->moduleHandler = $moduleHandler;
29 protected function interact(InputInterface $input, OutputInterface $output)
31 $questions = Utils::defaultQuestions();
33 $vars = &$this->collectVars($input, $output, $questions);
34 $vars['class'] = Utils::camelize('Example_' . $vars['machine_name'] . '_Commands');
37 ->path('src/Commands/{class}.php')
38 ->template('example-generator.twig');