From de5748070da42105eb3ecb84793066d7cf56a28f Mon Sep 17 00:00:00 2001 From: Bernhard Schussek Date: Thu, 17 Mar 2011 12:22:49 +0100 Subject: [PATCH] [FrameworkBundle] Removed EventSubscriber support for DI tags because it currently cannot be implemented --- .../ContainerAwareEventDispatcher.php | 18 ------------------ .../Compiler/RegisterKernelListenersPass.php | 6 +++--- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php b/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php index 453a40dee914..9dd8cddc9dfe 100644 --- a/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php +++ b/src/Symfony/Bundle/FrameworkBundle/ContainerAwareEventDispatcher.php @@ -68,24 +68,6 @@ public function addEventListenerService($events, $serviceId, $priority = 0) } } - /** - * 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} * diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php index 45ecf5a388c5..a7d55855a450 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/RegisterKernelListenersPass.php @@ -31,10 +31,10 @@ public function process(ContainerBuilder $container) $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)); } } }