예제 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // @see use Drupal\Console\Command\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io)) {
         return;
     }
     $module = $input->getOption('module');
     if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_help')) {
         throw new \Exception(sprintf($this->trans('commands.generate.help.messages.help-already-implemented'), $module));
     }
     $description = $input->getOption('description');
     $this->generator->generate($module, $description);
     $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']);
 }
예제 #2
0
 protected function validatePostUpdateName($module, $postUpdateName)
 {
     if (!$this->validator->validateSpaces($postUpdateName)) {
         throw new \InvalidArgumentException(sprintf($this->trans('commands.generate.post.update.messages.wrong-post-update-name'), $postUpdateName));
     }
     if ($this->extensionManager->validateModuleFunctionExist($module, $module . '_post_update_' . $postUpdateName, $module . '.post_update.php')) {
         throw new \InvalidArgumentException(sprintf($this->trans('commands.generate.post.update.messages.post-update-name-already-implemented'), $postUpdateName));
     }
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new DrupalStyle($input, $output);
     // @see use Drupal\Console\Command\Shared\ConfirmationTrait::confirmGeneration
     if (!$this->confirmGeneration($io)) {
         return;
     }
     $module = $input->getOption('module');
     $formId = $input->getOption('form-id');
     $inputs = $input->getOption('inputs');
     $function = $module . '_form_' . $formId . '_alter';
     if ($this->extensionManager->validateModuleFunctionExist($module, $function)) {
         throw new \Exception(sprintf($this->trans('commands.generate.form.alter.messages.help-already-implemented'), $module));
     }
     //validate if input is an array
     if (!is_array($inputs[0])) {
         $inputs = $this->explodeInlineArray($inputs);
     }
     $this->generator->generate($module, $formId, $inputs, $this->metadata);
     $this->chainQueue->addCommand('cache:rebuild', ['cache' => 'discovery']);
 }