Ver código fonte

[FrameworkBundle] updated the init:bundle skeleton files

Fabien Potencier 14 anos atrás
pai
commit
d4fc3c98b1

+ 1 - 1
src/Symfony/Bundle/FrameworkBundle/Command/InitBundleCommand.php

@@ -35,7 +35,7 @@ class InitBundleCommand extends Command
                 new InputArgument('namespace', InputArgument::REQUIRED, 'The namespace of the bundle to create'),
                 new InputArgument('dir', InputArgument::REQUIRED, 'The directory where to create the bundle'),
                 new InputArgument('bundleName', InputArgument::OPTIONAL, 'The optional bundle name'),
-                new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, or yml)', 'xml')
+                new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, or yml)', 'yml')
             ))
             ->setHelp(<<<EOT
 The <info>init:bundle</info> command generates a new bundle with a basic skeleton.

+ 3 - 1
src/Symfony/Bundle/FrameworkBundle/Resources/skeleton/bundle/php/Resources/config/routing.php

@@ -6,7 +6,9 @@ use Symfony\Component\Routing\Route;
 $collection = new RouteCollection();
 /*
 $collection->add('homepage', new Route('/', array(
-    '_controller' => 'NewBundle:Default:index',
+    '_controller' => '{{ bundle }}:Default:index',
 )));
+
+$collection->import("{{ bundle }}/Controller", '/prefix');
 */
 return $collection;

+ 7 - 0
src/Symfony/Bundle/FrameworkBundle/Resources/skeleton/bundle/xml/Resources/config/routing.xml

@@ -4,4 +4,11 @@
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
 
+    <!--
+    <route id="homepage" pattern="/">
+        <default key="_controller">{{ bundle }}:Default:denied</default>
+    </route>
+
+    <import resource="@{{ bundle }}/Resources/config/routing.xml" prefix="/prefix" />
+    //-->
 </routes>

+ 5 - 1
src/Symfony/Bundle/FrameworkBundle/Resources/skeleton/bundle/yml/Resources/config/routing.yml

@@ -1,3 +1,7 @@
 #homepage:
 #    pattern:  /
-#    defaults: { _controller: NewBundle:Default:index }
+#    defaults: { _controller: {{ bundle }}:Default:index }
+#
+#{{ bundle }}:
+#   resource: "@{{ bundle }}/Resources/config/routing.yml"
+#   prefix:   /prefix"