From c5134bd6762dd0a4028353c33496b6584e661036 Mon Sep 17 00:00:00 2001 From: webchick Date: Fri, 4 Jan 2013 09:49:17 -0800 Subject: [PATCH] Issue #1879444 by fabpot: Fixed Removed an unneeded factory. --- core/lib/Drupal/Core/CoreBundle.php | 8 +++++--- core/lib/Drupal/Core/ExceptionController.php | 18 ------------------ 2 files changed, 5 insertions(+), 21 deletions(-) diff --git a/core/lib/Drupal/Core/CoreBundle.php b/core/lib/Drupal/Core/CoreBundle.php index 691e6e74438..ff48b04f3e7 100644 --- a/core/lib/Drupal/Core/CoreBundle.php +++ b/core/lib/Drupal/Core/CoreBundle.php @@ -216,11 +216,13 @@ class CoreBundle extends Bundle { ->addTag('event_subscriber'); $container->register('config_global_override_subscriber', 'Drupal\Core\EventSubscriber\ConfigGlobalOverrideSubscriber') ->addTag('event_subscriber'); + + $container->register('exception_controller', 'Drupal\Core\ExceptionController') + ->addArgument(new Reference('content_negotiation')) + ->addMethodCall('setContainer', array(new Reference('service_container'))); $container->register('exception_listener', 'Drupal\Core\EventSubscriber\ExceptionListener') ->addTag('event_subscriber') - ->addArgument(new Reference('service_container')) - ->setFactoryClass('Drupal\Core\ExceptionController') - ->setFactoryMethod('getExceptionListener'); + ->addArgument(array(new Reference('exception_controller'), 'execute')); $container ->register('transliteration', 'Drupal\Core\Transliteration\PHPTransliteration'); diff --git a/core/lib/Drupal/Core/ExceptionController.php b/core/lib/Drupal/Core/ExceptionController.php index 352ffeac9d2..c8c6a34b82a 100644 --- a/core/lib/Drupal/Core/ExceptionController.php +++ b/core/lib/Drupal/Core/ExceptionController.php @@ -27,24 +27,6 @@ class ExceptionController extends ContainerAware { */ protected $negotiation; - /** - * Instantiates a new exception listener. - * - * Factory method for getting an Exception Listener. Since this needs to be - * instanciated with a controller callable, i.e. an ExceptionConroller object - * and the name of the method to call, we can't just register it to the DIC - * the regular way. - * - * @todo This probably doesn't belong here, but I'm not sure where would be a - * better place to put it... in a class of its own? - */ - public static function getExceptionListener(Container $container) { - $negotiation = $container->get('content_negotiation'); - $exceptionController = new self($negotiation); - $exceptionController->setContainer($container); - return new ExceptionListener(array($exceptionController, 'execute')); - } - /** * Constructor. *