Преглед изворни кода

[FrameworkBundle] Removed EventSubscriber support for DI tags because it currently cannot be implemented

Bernhard Schussek пре 14 година
родитељ
комит
de5748070d

+ 0 - 18
src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php

@@ -68,24 +68,6 @@ class ContainerAwareEventDispatcher extends EventDispatcher
         }
     }
 
-    /**
-     * Adds a service as event subscriber
-     *
-     * @param string $serviceId  The ID of the subscriber service
-     * @param integer $priority  The higher this value, the earlier an event
-     *                           listener will be triggered in the chain.
-     *                           Defaults to 0.
-     */
-    public function addEventSuscriberService($serviceId, $priority = 0)
-    {
-        if (!is_string($serviceId)) {
-            throw new \InvalidArgumentException('Expected a string argument');
-        }
-
-        // TODO get class name, call static method getSubscribedEvents()
-        // and pass to addEventListenerService
-    }
-
     /**
      * {@inheritDoc}
      *

+ 3 - 3
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php

@@ -31,10 +31,10 @@ class RegisterKernelListenersPass implements CompilerPassInterface
                 $priority = isset($event['priority']) ? $event['priority'] : 0;
 
                 if (!isset($event['event'])) {
-                    $definition->addMethodCall('addEventSubscriberService', array($id, $priority));
-                } else {
-                    $definition->addMethodCall('addEventListenerService', array($event['event'], $id, $priority));
+                    throw new \InvalidArgumentException(sprintf('Service "%s" must define the "event" attribute on "kernel.listener" tags.', $id));
                 }
+
+                $definition->addMethodCall('addEventListenerService', array($event['event'], $id, $priority));
             }
         }
     }