Quellcode durchsuchen

[Foundation] moved event_dispatcher debug mode to Foundation

Fabien Potencier vor 15 Jahren
Ursprung
Commit
45e6573774

+ 14 - 0
src/Symfony/Foundation/Bundle/KernelBundle.php

@@ -6,6 +6,8 @@ use Symfony\Foundation\Bundle\Bundle;
 use Symfony\Foundation\ClassCollectionLoader;
 use Symfony\Components\DependencyInjection\ContainerInterface;
 use Symfony\Components\DependencyInjection\Loader\Loader;
+use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Components\DependencyInjection\BuilderConfiguration;
 
 /*
  * This file is part of the symfony framework.
@@ -27,6 +29,18 @@ class KernelBundle extends Bundle
   public function buildContainer(ContainerInterface $container)
   {
     Loader::registerExtension(new KernelExtension());
+
+    $configuration = new BuilderConfiguration();
+
+    $loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
+    $configuration->merge($loader->load('services.xml'));
+
+    if ($container->getParameter('kernel.debug'))
+    {
+      $configuration->setDefinition('event_dispatcher', $configuration->findDefinition('debug.event_dispatcher'));
+    }
+
+    $container->merge($configuration);
   }
 
   public function boot(ContainerInterface $container)

+ 0 - 3
src/Symfony/Foundation/Bundle/KernelExtension.php

@@ -26,9 +26,6 @@ class KernelExtension extends LoaderExtension
   {
     $configuration = new BuilderConfiguration();
 
-    $loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
-    $configuration->merge($loader->load('services.xml'));
-
     if (isset($config['charset']))
     {
       $configuration->setParameter('kernel.charset', $config['charset']);

+ 14 - 3
src/Symfony/Foundation/bootstrap.php

@@ -40,6 +40,8 @@ use Symfony\Foundation\Bundle\Bundle;
 use Symfony\Foundation\ClassCollectionLoader;
 use Symfony\Components\DependencyInjection\ContainerInterface;
 use Symfony\Components\DependencyInjection\Loader\Loader;
+use Symfony\Components\DependencyInjection\Loader\XmlFileLoader;
+use Symfony\Components\DependencyInjection\BuilderConfiguration;
 
 
 
@@ -49,6 +51,18 @@ class KernelBundle extends Bundle
   public function buildContainer(ContainerInterface $container)
   {
     Loader::registerExtension(new KernelExtension());
+
+    $configuration = new BuilderConfiguration();
+
+    $loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
+    $configuration->merge($loader->load('services.xml'));
+
+    if ($container->getParameter('kernel.debug'))
+    {
+      $configuration->setDefinition('event_dispatcher', $configuration->findDefinition('debug.event_dispatcher'));
+    }
+
+    $container->merge($configuration);
   }
 
   public function boot(ContainerInterface $container)
@@ -75,9 +89,6 @@ class KernelExtension extends LoaderExtension
   {
     $configuration = new BuilderConfiguration();
 
-    $loader = new XmlFileLoader(array(__DIR__.'/../Resources/config', __DIR__.'/Resources/config'));
-    $configuration->merge($loader->load('services.xml'));
-
     if (isset($config['charset']))
     {
       $configuration->setParameter('kernel.charset', $config['charset']);

+ 0 - 2
src/Symfony/Framework/WebBundle/DependencyInjection/WebExtension.php

@@ -166,8 +166,6 @@ class WebExtension extends LoaderExtension
       $configuration->setParameter('web_debug.file_link_format', 'txmt://open?url=file://%%f&line=%%l');
     }
 
-    $configuration->setAlias('event_dispatcher', 'debug.event_dispatcher');
-
     return $configuration;
   }