3 namespace DrupalCodeGenerator\Command\Drupal_8\Service;
5 use DrupalCodeGenerator\Command\BaseGenerator;
6 use DrupalCodeGenerator\Utils;
7 use Symfony\Component\Console\Input\InputInterface;
8 use Symfony\Component\Console\Output\OutputInterface;
11 * Implements d8:service:event-subscriber command.
13 class EventSubscriber extends BaseGenerator {
15 protected $name = 'd8:service:event-subscriber';
16 protected $description = 'Generates an event subscriber';
17 protected $alias = 'event-subscriber';
22 protected function interact(InputInterface $input, OutputInterface $output) {
23 $questions = Utils::defaultQuestions();
25 $vars = &$this->collectVars($input, $output, $questions);
26 $vars['class'] = Utils::camelize($vars['name'] . 'Subscriber');
29 ->path('src/EventSubscriber/{class}.php')
30 ->template('d8/service/event-subscriber.twig');
32 $this->addServicesFile()
33 ->template('d8/service/event-subscriber.services.twig');