/**
  * Generate Standalone Files
  *
  * @param string $bundle The bundle name
  * @param string $tag    A tag name to filter files
  */
 public function generateStandaloneFiles($bundle, $tag)
 {
     $avroGenerator = new Generator($this->container, $this->output);
     $avroGenerator->initializeBundleParameters($bundle->getName());
     $standaloneFiles = $this->container->getParameter('avro_generator.standalone_files');
     if (is_array($standaloneFiles)) {
         foreach ($standaloneFiles as $file) {
             if ($tag) {
                 if (in_array($tag, $file['tags'])) {
                     $avroGenerator->generate($file);
                 }
             } else {
                 $avroGenerator->generate($file);
             }
         }
     }
 }
 public function generateBundle($bundleName, $tag)
 {
     $filesystem = $this->container->get('filesystem');
     $this->dialog->writeSection($this->output, sprintf('%s does not exist. Would you like to create it?', $bundleName));
     if (!$this->dialog->askConfirmation($this->output, $this->dialog->getQuestion('Create a new bundle?', 'yes', '?'), true)) {
         return false;
     }
     if (Validators::validateBundleName($bundleName)) {
         list($vendor, $basename) = $this->parseBundleName($bundleName);
     } else {
         $this->dialog->writeSection($this->output, 'Welcome to the Avro bundle generator');
         // namespace
         $this->output->writeln(array('', 'Enter the vendor name for the bundle. (ie. Application, FOS, Sensio, etc)'));
         // vendor
         $vendor = $this->dialog->ask($this->output, 'Bundle vendor: ');
         $vendor = Validators::validateVendor($vendor);
         // bundle name
         $this->output->writeln(array('', 'Enter the base name of the bundle. (ie. UserBundle, CalendarBundle, etc)'));
         $basename = $this->dialog->ask($this->output, 'Bundle base name: ');
         $bundleName = Validators::validateBundleName($vendor . $basename);
     }
     //bundleNamespace
     $bundleNamespace = Validators::validateBundleNamespace($vendor . '\\' . $basename);
     $bundlePath = $this->getContainer()->getParameter('kernel.root_dir') . '/../vendor/' . lcfirst($vendor) . '/' . strtolower(str_replace('Bundle', '', $basename) . '-bundle') . '/' . $vendor . '/' . $basename . '/';
     $generator = new Generator($this->container, $this->output);
     $generator->initializeBundleParameters($vendor . $basename);
     $folders = $this->container->getParameter('avro_generator.bundle_folders');
     if (is_array($folders)) {
         foreach ($folders as $folder) {
             if ($tag && array_key_exists('tags', $folder)) {
                 if (in_array($tag, $folder['tags'])) {
                     $generator->renderFolder($bundlePath . $folder['path']);
                 }
             } else {
                 $generator->renderFolder($bundlePath . $folder['path']);
             }
         }
     }
     $files = $this->container->getParameter('avro_generator.bundle_files');
     if (is_array($files)) {
         foreach ($files as $file) {
             if ($tag && array_key_exists('tags', $file)) {
                 if (in_array($tag, $file['tags'])) {
                     $generator->renderFile($file['template'], $file['filename']);
                 }
             } else {
                 $generator->renderFile($file['template'], $file['filename']);
             }
         }
     }
 }