diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php
index e7d2110f7960..4247ba68b0ba 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php
@@ -80,6 +80,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new \InvalidArgumentException('The bundle name must end with Bundle.');
}
+ // validate that the namespace is at least one level deep
+ if (false === strpos($namespace, '\\')) {
+ $msg = array();
+ $msg[] = sprintf('The namespace must contain a vendor namespace (e.g. "VendorName\%s" instead of simply "%s").', $namespace, $namespace);
+ $msg[] = 'If you\'ve specified a vendor namespace, did you forget to surround it with quotes (init:bundle "Acme\BlogBundle")?';
+
+ throw new \InvalidArgumentException(implode("\n\n", $msg));
+ }
+
$dir = $input->getArgument('dir');
// add trailing / if necessary
@@ -87,7 +96,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$targetDir = $dir.strtr($namespace, '\\', '/');
- $output->writeln(sprintf('Initializing bundle "%s" in "%s"', $bundle, $dir));
+
if (file_exists($targetDir)) {
throw new \RuntimeException(sprintf('Bundle "%s" already exists.', $bundle));
@@ -103,5 +112,24 @@ protected function execute(InputInterface $input, OutputInterface $output)
));
rename($targetDir.'/Bundle.php', $targetDir.'/'.$bundle.'.php');
+
+ $output->writeln('Summary of actions');
+ $output->writeln(sprintf('- The bundle "%s" was created at "%s" and is using the namespace "%s".', $bundle, $targetDir, $namespace));
+ $output->writeln(sprintf('- The bundle contains a sample controller, a sample template and a sample routing file.'));
+
+ $output->writeln('');
+ $output->writeln('Follow-up actions');
+
+ $output->writeln('- Enable the bundle inside the AppKernel::registerBundles() method.');
+ $output->writeln(' Resource: http://symfony.com/doc/2.0/book/page_creation.html#create-the-bundle');
+
+ $output->writeln('- Ensure that the namespace is registered with the autoloader.');
+ $output->writeln(' Resource: http://symfony.com/doc/2.0/book/page_creation.html#autoloading-introduction-sidebar');
+
+ $output->writeln('- If using routing, import the bundle\'s routing resource.');
+ $output->writeln(' Resource: http://symfony.com/doc/2.0/book/routing.html#including-external-routing-resources');
+
+ $output->writeln('- Starting building your bundle!');
+ $output->writeln(' Resource: http://symfony.com/doc/2.0/book/page_creation.html#the-hello-symfony-page');
}
}