ソースを参照

removed dependency on the _welcome route

Fabien Potencier 14 年 前
コミット
868d8db9ca

+ 7 - 0
Controller/ConfiguratorController.php

@@ -95,7 +95,14 @@ class ConfiguratorController extends ContainerAware
         $configurator = $this->container->get('sensio.distribution.webconfigurator');
         $configurator->clean();
 
+        try {
+            $welcomeUrl = $this->container->get('router')->generate('_welcome');
+        } catch (\Exception $e) {
+            $welcomeUrl = null;
+        }
+
         return $this->container->get('templating')->renderResponse('SensioDistributionBundle::Configurator/final.html.twig', array(
+            'welcome_url' => $welcomeUrl,
             'parameters'  => $configurator->render(),
             'ini_path'    => $this->container->getParameter('kernel.root_dir').'/config/parameters.ini',
             'is_writable' => $configurator->isFileWritable(),

+ 5 - 3
Resources/views/Configurator/final.html.twig

@@ -20,7 +20,9 @@
 
     <textarea class="symfony-configuration">{{ parameters }}</textarea>
 
-    <ul>
-        <li><a href="{{ path('_welcome') }}">Go to the Welcome page</a></li>
-    </ul>
+    {% if welcome_url %}
+        <ul>
+            <li><a href="{{ welcome_url }}">Go to the Welcome page</a></li>
+        </ul>
+    {% endif %}
 {% endblock %}