/** * Ensures that the theme registry was not initialized. */ public function onView(GetResponseEvent $event) { $current_route = $this->currentRouteMatch->getRouteName(); $entity_autcomplete_route = array('system.entity_autocomplete'); if (in_array($current_route, $entity_autcomplete_route)) { if ($this->container->initialized('theme.registry')) { throw new \Exception('registry initialized'); } } }
/** * Ensures that the theme registry was not initialized. */ public function onView(GetResponseEvent $event) { $request = $event->getRequest(); $current_path = $request->attributes->get('_system_path'); if (strpos($current_path, 'user/autocomplete') === 0) { if ($this->container->initialized('theme.registry')) { throw new \Exception('registry initialized'); } } }
/** * {@inheritdoc} */ public function collect(Request $request, Response $response, \Exception $exception = NULL) { if ($this->getServicesCount()) { $tracedData = []; if ($this->container instanceof TraceableContainer) { $tracedData = $this->container->getTracedData(); } foreach (array_keys($this->getServices()) as $id) { $this->data['services'][$id]['initialized'] = $this->container->initialized($id) ? TRUE : FALSE; $this->data['services'][$id]['time'] = isset($tracedData[$id]) ? $tracedData[$id] : NULL; } } }
/** * Ensure that dynamic settings are correctly reset, * so that services that rely on those are correctly updated */ private function resetDynamicSettings() { // Ensure to reset services that need to be. foreach ($this->resettableServiceIds as $serviceId) { if (!$this->container->initialized($serviceId)) { continue; } $this->container->set($serviceId, null); } // Update services that can be updated. foreach ($this->updatableServices as $serviceId => $methodCalls) { if (!$this->container->initialized($serviceId)) { continue; } $service = $this->container->get($serviceId); foreach ($methodCalls as $callConfig) { list($method, $expression) = $callConfig; $argument = $this->expressionLanguage->evaluate($expression, ['container' => $this->container]); call_user_func_array([$service, $method], [$argument]); } } }