/**
  * {@inheritDoc}
  *
  * @return ResourceGenerator
  */
 protected function createGenerator()
 {
     // do we have a json path passed?
     if ($this->input->getOption('json') !== null) {
         $definitions = $this->definitionLoader->load($this->input->getOption('json'));
         if (count($definitions) > 0) {
             $this->resourceGenerator->setJson($definitions[0]);
         }
     }
     $this->resourceGenerator->setGenerateController($this->input->getOption('no-controller') != 'true');
     return $this->resourceGenerator;
 }
 /**
  * {@inheritDoc}
  *
  * @param InputInterface  $input  input
  * @param OutputInterface $output output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     /**
      * GENERATE THE BUNDLEBUNDLE
      */
     $namespace = sprintf(self::BUNDLE_NAME_MASK, 'Bundle');
     // GravitonDynBundleBundle
     $bundleName = str_replace('/', '', $namespace);
     // bundlebundle stuff..
     $this->bundleBundleNamespace = $namespace;
     $this->bundleBundleDir = $input->getOption('srcDir') . $namespace;
     $this->bundleBundleClassname = $bundleName;
     $this->bundleBundleClassfile = $this->bundleBundleDir . '/' . $this->bundleBundleClassname . '.php';
     $filesToWorkOn = $this->definitionLoader->load($input->getOption('json'));
     if (count($filesToWorkOn) < 1) {
         throw new \LogicException("Could not find any usable JSON files.");
     }
     /**
      * GENERATE THE BUNDLE(S)
      */
     foreach ($filesToWorkOn as $jsonDef) {
         $thisIdName = $jsonDef->getId();
         $namespace = sprintf(self::BUNDLE_NAME_MASK, $thisIdName);
         $jsonDef->setNamespace($namespace);
         $bundleName = str_replace('/', '', $namespace);
         $this->bundleBundleList[] = $namespace;
         try {
             $this->generateBundle($namespace, $bundleName, $input, $output);
             $this->generateBundleBundleClass();
             $this->generateSubResources($output, $jsonDef, $this->xmlManipulator, $bundleName, $namespace);
             $this->generateMainResource($output, $jsonDef, $bundleName);
             $this->generateValidationXml($this->xmlManipulator, $this->getGeneratedValidationXmlPath($namespace));
             $output->writeln('');
             $output->writeln(sprintf('<info>Generated "%s" from definition %s</info>', $bundleName, $jsonDef->getId()));
             $output->writeln('');
         } catch (\Exception $e) {
             $output->writeln(sprintf('<error>%s</error>', $e->getMessage()));
             // remove failed bundle from list
             array_pop($this->bundleBundleList);
         }
         $this->xmlManipulator->reset();
     }
 }