Commit a492f4b1 authored by lussoluca's avatar lussoluca Committed by lussoluca

Issue #2710787 by lussoluca: Circular reference detected for service "access_manager"

parent 70f62fd0
...@@ -3,7 +3,6 @@ ...@@ -3,7 +3,6 @@
namespace Drupal\webprofiler\Routing; namespace Drupal\webprofiler\Routing;
use Drupal\Core\ParamConverter\ParamConverterInterface; use Drupal\Core\ParamConverter\ParamConverterInterface;
use Drupal\webprofiler\Profiler\Profiler;
use Symfony\Component\Routing\Route; use Symfony\Component\Routing\Route;
/** /**
...@@ -11,29 +10,22 @@ use Symfony\Component\Routing\Route; ...@@ -11,29 +10,22 @@ use Symfony\Component\Routing\Route;
*/ */
class TokenConverter implements ParamConverterInterface { class TokenConverter implements ParamConverterInterface {
/**
* @var \Drupal\webprofiler\Profiler\Profiler
*/
private $profiler;
/**
* Constructs a new WebprofilerController.
*
* @param \Drupal\webprofiler\Profiler\Profiler $profiler
*/
public function __construct(Profiler $profiler) {
$this->profiler = $profiler;
}
/** /**
* {@inheritdoc} * {@inheritdoc}
*/ */
public function convert($value, $definition, $name, array $defaults) { public function convert($value, $definition, $name, array $defaults) {
if (NULL === $this->profiler) { // "profiler" service isn't injected to prevent circular reference when
// more than one language is active and "Account administration pages" is
// enabled on admin/config/regional/language/detection. See #2710787 for
// more information.
/** @var \Drupal\webprofiler\Profiler\Profiler $profiler */
$profiler = \Drupal::service('profiler');
if (NULL === $profiler) {
return NULL; return NULL;
} }
$profile = $this->profiler->loadProfile($value); $profile = $profiler->loadProfile($value);
if (NULL === $profile) { if (NULL === $profile) {
return NULL; return NULL;
......
...@@ -253,7 +253,6 @@ services: ...@@ -253,7 +253,6 @@ services:
# parameter converter service for profile token # parameter converter service for profile token
webprofiler.token_converter: webprofiler.token_converter:
class: Drupal\webprofiler\Routing\TokenConverter class: Drupal\webprofiler\Routing\TokenConverter
arguments: ['@profiler']
tags: tags:
- { name: paramconverter } - { name: paramconverter }
......
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