/**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $questionHelper = $this->getQuestionHelper();
     if ($input->isInteractive()) {
         $confirmationQuestion = new ConfirmationQuestion($questionHelper->getQuestion('Do you confirm generation', 'yes', '?'), true);
         if (!$questionHelper->ask($input, $output, $confirmationQuestion)) {
             $output->writeln('<error>Command aborted</error>');
             return 1;
         }
     }
     GeneratorUtils::ensureOptionsProvided($input, array('entity', 'fields', 'prefix'));
     $entityInput = Validators::validateEntityName($input->getOption('entity'));
     list($bundleName, $entity) = $this->parseShortcutNotation($entityInput);
     $format = 'annotation';
     $fields = $this->parseFields($input->getOption('fields'));
     $prefix = $input->getOption('prefix');
     $questionHelper->writeSection($output, 'Entity generation');
     $bundle = $this->getContainer()->get('kernel')->getBundle($bundleName);
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->generate($bundle, $entity, $format, array_values($fields), $input->getOption('with-repository'), $prefix);
     $output->writeln('Generating the entity code: <info>OK</info>');
     $withAdminlist = $input->getOption('with-adminlist');
     if ($withAdminlist) {
         $command = $this->getApplication()->find('kuma:generate:adminlist');
         $arguments = array('command' => 'doctrine:fixtures:load', '--entity' => $entityInput);
         $input = new ArrayInput($arguments);
         $command->run($input, $output);
     }
     $questionHelper->writeGeneratorSummary($output, array());
     $output->writeln(array('Make sure you update your database first before you test the entity/adminlist:', '    Directly update your database:          <comment>app/console doctrine:schema:update --force</comment>', '    Create a Doctrine migration and run it: <comment>app/console doctrine:migrations:diff && app/console doctrine:migrations:migrate</comment>', ''));
 }
 /**
  * Executes the command.
  *
  * @param InputInterface $input An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @throws \RuntimeException
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $questionHelper = $this->getQuestionHelper();
     if ($input->isInteractive()) {
         $confirmationQuestion = new ConfirmationQuestion($questionHelper->getQuestion('Do you confirm generation', 'yes', '?'), true);
         if (!$questionHelper->ask($input, $output, $confirmationQuestion)) {
             $output->writeln('<error>Command aborted</error>');
             return 1;
         }
     }
     GeneratorUtils::ensureOptionsProvided($input, array('namespace', 'dir'));
     $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
     if (!($bundle = $input->getOption('bundle-name'))) {
         $bundle = strtr($namespace, array('\\' => ''));
     }
     $bundle = Validators::validateBundleName($bundle);
     $dir = $this::validateTargetDir($input->getOption('dir'), $bundle, $namespace);
     $format = 'yml';
     $questionHelper->writeSection($output, 'Bundle generation');
     if (!$this->getContainer()->get('filesystem')->isAbsolutePath($dir)) {
         $dir = getcwd() . '/' . $dir;
     }
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->generate($namespace, $bundle, $dir, $format);
     $output->writeln('Generating the bundle code: <info>OK</info>');
     $errors = array();
     $runner = $questionHelper->getRunner($output, $errors);
     // check that the namespace is already autoloaded
     $runner($this->checkAutoloader($output, $namespace, $bundle));
     // register the bundle in the Kernel class
     $runner($this->updateKernel($questionHelper, $input, $output, $this->getContainer()->get('kernel'), $namespace, $bundle));
     // routing
     $runner($this->updateRouting($questionHelper, $input, $output, $bundle, $format));
     $questionHelper->writeGeneratorSummary($output, $errors);
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $questionHelper = $this->getQuestionHelper();
     $questionHelper->writeSection($output, 'Admin Tests Generation');
     GeneratorUtils::ensureOptionsProvided($input, array('namespace'));
     $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
     $bundle = strtr($namespace, array('\\Bundle\\' => '', '\\' => ''));
     $bundle = $this->getApplication()->getKernel()->getBundle($bundle);
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->generate($bundle, $output);
 }
 /**
  * Executes the command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  *
  * @throws \RuntimeException
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dialog = $this->getDialogHelper();
     GeneratorUtils::ensureOptionsProvided($input, array('entity'));
     $entity = Validators::validateEntityName($input->getOption('entity'));
     list($bundle, $entity) = $this->parseShortcutNotation($entity);
     $entityClass = $this->getContainer()->get('doctrine')->getEntityNamespace($bundle) . '\\' . $entity;
     $metadata = $this->getEntityMetadata($entityClass);
     $bundle = $this->getContainer()->get('kernel')->getBundle($bundle);
     $dialog->writeSection($output, 'AdminList Generation');
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->setDialog($dialog);
     $generator->generate($bundle, $entityClass, $metadata[0], $output);
     $parts = explode('\\', $entity);
     $entityClass = array_pop($parts);
     $this->updateRouting($dialog, $input, $output, $bundle, $entityClass);
 }
 /**
  * Executes the command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dialog = $this->getDialogHelper();
     $dialog->writeSection($output, 'Article Generation');
     GeneratorUtils::ensureOptionsProvided($input, array('namespace', 'entity'));
     $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
     $bundle = strtr($namespace, array('\\' => ''));
     $entity = ucfirst($input->getOption('entity'));
     $prefix = $input->getOption('prefix');
     $dummydata = $input->getOption('dummydata');
     $bundle = $this->getApplication()->getKernel()->getBundle($bundle);
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->generate($bundle, $entity, $prefix, $dummydata, $output);
     $output->writeln(array('Make sure you update your database first before using the created entities:', '    Directly update your database:          <comment>app/console doctrine:schema:update --force</comment>', '    Create a Doctrine migration and run it: <comment>app/console doctrine:migrations:diff && app/console doctrine:migrations:migrate</comment>'));
     if ($dummydata) {
         $output->writeln('    New DataFixtures were created. You can load them via: <comment>app/console doctrine:fixtures:load --fixtures=src/' . str_replace('\\', '/', $bundle->getNamespace()) . '/DataFixtures/ORM/ArticleGenerator/ --append</comment>');
     }
     $output->writeln('');
 }
 /**
  * Executes the command.
  *
  * @param InputInterface  $input  An InputInterface instance
  * @param OutputInterface $output An OutputInterface instance
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $questionHelper = $this->getQuestionHelper();
     $questionHelper->writeSection($output, 'Search Page Generation');
     GeneratorUtils::ensureOptionsProvided($input, array('namespace'));
     $namespace = Validators::validateBundleNamespace($input->getOption('namespace'));
     $bundle = strtr($namespace, array('\\' => ''));
     $prefix = $input->getOption('prefix');
     $createPage = $input->getOption('createpage');
     $bundle = $this->getApplication()->getKernel()->getBundle($bundle);
     $rootDir = $this->getApplication()->getKernel()->getRootDir();
     $generator = $this->getGenerator($this->getApplication()->getKernel()->getBundle("KunstmaanGeneratorBundle"));
     $generator->generate($bundle, $prefix, $rootDir, $createPage, $output);
     $output->writeln(array('Make sure you update your database first before you test the pagepart:', '    Directly update your database:          <comment>app/console doctrine:schema:update --force</comment>', '    Create a Doctrine migration and run it: <comment>app/console doctrine:migrations:diff && app/console doctrine:migrations:migrate</comment>'));
     if ($createPage) {
         $output->writeln('    New DataFixtures were created. You can load them via: <comment>app/console doctrine:fixtures:load --fixtures=src/' . str_replace('\\', '/', $bundle->getNamespace()) . '/DataFixtures/ORM/SearchPageGenerator/ --append</comment>');
     }
     $output->writeln('');
 }