fix error with custom function and web profiler routing tab
This commit is contained in:
parent
a2f4342d08
commit
b35c81becb
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
namespace Symfony\Bundle\WebProfilerBundle\Controller;
|
namespace Symfony\Bundle\WebProfilerBundle\Controller;
|
||||||
|
|
||||||
|
use Symfony\Component\ExpressionLanguage\ExpressionFunctionProviderInterface;
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
|
use Symfony\Component\HttpKernel\DataCollector\RequestDataCollector;
|
||||||
@ -36,12 +37,18 @@ class RouterController
|
|||||||
private $matcher;
|
private $matcher;
|
||||||
private $routes;
|
private $routes;
|
||||||
|
|
||||||
public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null)
|
/**
|
||||||
|
* @var ExpressionFunctionProviderInterface[]
|
||||||
|
*/
|
||||||
|
private $expressionLanguageProviders = [];
|
||||||
|
|
||||||
|
public function __construct(Profiler $profiler = null, Environment $twig, UrlMatcherInterface $matcher = null, RouteCollection $routes = null, iterable $expressionLanguageProviders = [])
|
||||||
{
|
{
|
||||||
$this->profiler = $profiler;
|
$this->profiler = $profiler;
|
||||||
$this->twig = $twig;
|
$this->twig = $twig;
|
||||||
$this->matcher = $matcher;
|
$this->matcher = $matcher;
|
||||||
$this->routes = (null === $routes && $matcher instanceof RouterInterface) ? $matcher->getRouteCollection() : $routes;
|
$this->routes = (null === $routes && $matcher instanceof RouterInterface) ? $matcher->getRouteCollection() : $routes;
|
||||||
|
$this->expressionLanguageProviders = $expressionLanguageProviders;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,6 +101,9 @@ class RouterController
|
|||||||
$context = $this->matcher->getContext();
|
$context = $this->matcher->getContext();
|
||||||
$context->setMethod($method);
|
$context->setMethod($method);
|
||||||
$matcher = new TraceableUrlMatcher($this->routes, $context);
|
$matcher = new TraceableUrlMatcher($this->routes, $context);
|
||||||
|
foreach ($this->expressionLanguageProviders as $provider) {
|
||||||
|
$matcher->addExpressionLanguageProvider($provider);
|
||||||
|
}
|
||||||
|
|
||||||
return $matcher->getTracesForRequest($traceRequest);
|
return $matcher->getTracesForRequest($traceRequest);
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
<argument type="service" id="profiler" on-invalid="null" />
|
<argument type="service" id="profiler" on-invalid="null" />
|
||||||
<argument type="service" id="twig" />
|
<argument type="service" id="twig" />
|
||||||
<argument type="service" id="router" on-invalid="null" />
|
<argument type="service" id="router" on-invalid="null" />
|
||||||
|
<argument>null</argument>
|
||||||
|
<argument type="tagged_iterator" tag="routing.expression_language_provider" />
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service id="web_profiler.controller.exception" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController" public="true">
|
<service id="web_profiler.controller.exception" class="Symfony\Bundle\WebProfilerBundle\Controller\ExceptionController" public="true">
|
||||||
|
Reference in New Issue
Block a user