/**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $questionHelper = $this->getQuestionHelper();
     if ($input->isInteractive()) {
         $question = new ConfirmationQuestion($questionHelper->getQuestion('Do you confirm generation', 'yes', '?'), true);
         if (!$questionHelper->ask($input, $output, $question)) {
             $output->writeln('<error>Command aborted</error>');
             return 1;
         }
     }
     $entity = Validators::validateEntityName($input->getOption('entity'));
     list($bundle, $entity) = $this->parseShortcutNotation($entity);
     $format = Validators::validateFormat($input->getOption('format'));
     $prefix = $this->getRoutePrefix($input, $entity);
     $withWrite = $input->getOption('with-write');
     $forceOverwrite = $input->getOption('overwrite');
     $questionHelper->writeSection($output, 'CRUD generation');
     $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity;
     $metadata = $this->getEntityMetadata($entityClass);
     $bundle = $this->getContainer()->get('kernel')->getBundle($bundle);
     $generator = $this->getGenerator($bundle);
     $generator->setSkeletonDirs($this->getContainer()->get('kernel')->locateResource('@OliorgaGeneratorBundle/Resources/skeleton'));
     $generator->generate($bundle, $entity, $metadata[0], $format, $prefix, $withWrite, $forceOverwrite);
     $output->writeln('Generating the CRUD code: <info>OK</info>');
     $errors = array();
     $runner = $questionHelper->getRunner($output, $errors);
     // form
     if ($withWrite) {
         $this->generateForm($bundle, $entity, $metadata);
         $output->writeln('Generating the Form code: <info>OK</info>');
     }
     $questionHelper->writeGeneratorSummary($output, $errors);
 }
 /**
  * @see Command
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $entity = Validators::validateEntityName($input->getArgument('entity'));
     list($bundle, $entity) = $this->parseShortcutNotation($entity);
     $entityClass = $this->getContainer()->get('doctrine')->getAliasNamespace($bundle) . '\\' . $entity;
     $metadata = $this->getEntityMetadata($entityClass);
     $bundle = $this->getApplication()->getKernel()->getBundle($bundle);
     $generator = new \Oliorga\GeneratorBundle\Generator\DoctrineFormGenerator($this->getContainer()->get('filesystem'));
     $generator->setSkeletonDirs($this->getContainer()->get('kernel')->locateResource('@OliorgaGeneratorBundle/Resources/skeleton'));
     $generator->generate($bundle, $entity, $metadata[0]);
     $output->writeln(sprintf('The new %s.php class file has been created under %s.', $generator->getClassName(), $generator->getClassPath()));
 }