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 @@
namespace Drupal\webprofiler\Routing;
use Drupal\Core\ParamConverter\ParamConverterInterface;
use Drupal\webprofiler\Profiler\Profiler;
use Symfony\Component\Routing\Route;
/**
......@@ -11,29 +10,22 @@ use Symfony\Component\Routing\Route;
*/
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}
*/
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;
}
$profile = $this->profiler->loadProfile($value);
$profile = $profiler->loadProfile($value);
if (NULL === $profile) {
return NULL;
......
......@@ -253,7 +253,6 @@ services:
# parameter converter service for profile token
webprofiler.token_converter:
class: Drupal\webprofiler\Routing\TokenConverter
arguments: ['@profiler']
tags:
- { 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