Commit bc1da650 authored by effulgentsia's avatar effulgentsia Committed by katbailey
Browse files

Remove DIC compilation until it can be dumped to disk

parent 842d1217
......@@ -26,8 +26,12 @@ class CoreBundle extends Bundle
{
public function build(ContainerBuilder $container) {
// Add a 'request' scope for services that depend on the Request object.
// The 'request' scope and service enable services to depend on the Request
// object and get reconstructed when the request object changes (e.g.,
// during a subrequest).
$container->addScope(new Scope('request'));
$container->register('request', 'Symfony\Component\HttpFoundation\Request')
->setSynthetic(TRUE);
$container->register('dispatcher', 'Symfony\Component\EventDispatcher\ContainerAwareEventDispatcher')
->addArgument(new Reference('service_container'));
......@@ -36,6 +40,27 @@ public function build(ContainerBuilder $container) {
->addArgument(new Reference('dispatcher'))
->addArgument(new Reference('service_container'))
->addArgument(new Reference('resolver'));
$container->register('language_manager', 'Drupal\Core\Language\LanguageManager')
->addArgument(new Reference('request'))
->setScope('request');
// @todo Replace below lines with the commented out block below it when it's
// performant to do so: http://drupal.org/node/1706064.
$dispatcher = $container->get('dispatcher');
$matcher = new \Drupal\Core\LegacyUrlMatcher();
$content_negotation = new \Drupal\Core\ContentNegotiation();
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\RouterListener($matcher));
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\ViewSubscriber($content_negotation));
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\AccessSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\MaintenanceModeSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\PathSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\LegacyRequestSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\LegacyControllerSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\FinishResponseSubscriber());
$dispatcher->addSubscriber(new \Drupal\Core\EventSubscriber\RequestCloseSubscriber());
$container->set('content_negotiation', $content_negotation);
$dispatcher->addSubscriber(\Drupal\Core\ExceptionController::getExceptionListener($container));
/*
$container->register('matcher', 'Drupal\Core\LegacyUrlMatcher');
$container->register('router_listener', 'Drupal\Core\EventSubscriber\RouterListener')
->addArgument(new Reference('matcher'))
......@@ -73,13 +98,9 @@ public function build(ContainerBuilder $container) {
->addArgument(new Reference('service_container'))
->setFactoryClass('Drupal\Core\ExceptionController')
->setFactoryMethod('getExceptionListener');
$container->register('request', 'Symfony\Component\HttpFoundation\Request')
->setSynthetic(TRUE);
$container->register('language_manager', 'Drupal\Core\Language\LanguageManager')
->addArgument(new Reference('request'))
->setScope('request');
// Add a compiler pass for registering event subscribers.
$container->addCompilerPass(new RegisterKernelListenersPass(), PassConfig::TYPE_AFTER_REMOVING);
*/
}
}
......@@ -74,7 +74,10 @@ protected function buildContainer() {
foreach ($this->bundles as $bundle) {
$bundle->build($container);
}
$container->compile();
// @todo Compile the container: http://drupal.org/node/1706064.
//$container->compile();
return $container;
}
......
......@@ -7,7 +7,6 @@
namespace Drupal\Core\EventSubscriber;
use Drupal\Core\Language\LanguageManager;
use Symfony\Component\HttpKernel\Event\FilterResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
......@@ -17,12 +16,6 @@
*/
class FinishResponseSubscriber implements EventSubscriberInterface {
protected $language_manager;
public function __construct(LanguageManager $language_manager) {
$this->language_manager = $language_manager;
}
/**
* Sets extra headers on successful responses.
*
......@@ -37,7 +30,10 @@ public function onRespond(FilterResponseEvent $event) {
$response->headers->set('X-UA-Compatible', 'IE=edge,chrome=1', false);
// Set the Content-language header.
$response->headers->set('Content-language', $this->language_manager->getLanguage(LANGUAGE_TYPE_INTERFACE)->langcode);
// @todo Receive the LanguageManager object as a constructor argument when
// the dependency injection container allows for it performantly:
// http://drupal.org/node/1706064.
$response->headers->set('Content-language', language_manager(LANGUAGE_TYPE_INTERFACE)->langcode);
// Because pages are highly dynamic, set the last-modified time to now
// since the page is in fact being regenerated right now.
......
......@@ -20,5 +20,9 @@ class BundleTestBundle extends Bundle
public function build(ContainerBuilder $container) {
$container->register('bundle_test_class', 'Drupal\bundle_test\TestClass')
->addTag('kernel.event_subscriber');
// @todo Remove when the 'kernel.event_subscriber' tag above is made to
// work: http://drupal.org/node/1706064.
$container->get('dispatcher')->addSubscriber($container->get('bundle_test_class'));
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment