diff --git a/Controller/ProfilerController.php b/Controller/ProfilerController.php
index 302590ca9..90531c41f 100644
--- a/Controller/ProfilerController.php
+++ b/Controller/ProfilerController.php
@@ -2,6 +2,7 @@
namespace Doctrine\Bundle\DoctrineBundle\Controller;
+use Doctrine\Bundle\DoctrineBundle\Registry;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\ForwardCompatibility\Result;
use Doctrine\DBAL\Platforms\OraclePlatform;
@@ -11,27 +12,30 @@
use PDO;
use PDOStatement;
use Symfony\Bridge\Doctrine\DataCollector\DoctrineDataCollector;
-use Symfony\Component\DependencyInjection\ContainerAwareInterface;
-use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Profiler\Profiler;
use Symfony\Component\VarDumper\Cloner\Data;
use Throwable;
+use Twig\Environment;
use function assert;
use function stripos;
-class ProfilerController implements ContainerAwareInterface
+/** @internal */
+class ProfilerController
{
- /** @var ContainerInterface */
- private $container;
-
- /**
- * {@inheritDoc}
- */
- public function setContainer(?ContainerInterface $container = null)
+ /** @var Environment */
+ private $twig;
+ /** @var Registry */
+ private $registry;
+ /** @var Profiler */
+ private $profiler;
+
+ public function __construct(Environment $twig, Registry $registry, Profiler $profiler)
{
- $this->container = $container;
+ $this->twig = $twig;
+ $this->registry = $registry;
+ $this->profiler = $profiler;
}
/**
@@ -45,11 +49,9 @@ public function setContainer(?ContainerInterface $container = null)
*/
public function explainAction($token, $connectionName, $query)
{
- $profiler = $this->container->get('profiler');
- assert($profiler instanceof Profiler);
- $profiler->disable();
+ $this->profiler->disable();
- $profile = $profiler->loadProfile($token);
+ $profile = $this->profiler->loadProfile($token);
$collector = $profile->getCollector('db');
assert($collector instanceof DoctrineDataCollector);
@@ -65,7 +67,7 @@ public function explainAction($token, $connectionName, $query)
return new Response('This query cannot be explained.');
}
- $connection = $this->container->get('doctrine')->getConnection($connectionName);
+ $connection = $this->registry->getConnection($connectionName);
assert($connection instanceof Connection);
try {
$platform = $connection->getDatabasePlatform();
@@ -82,7 +84,7 @@ public function explainAction($token, $connectionName, $query)
return new Response('This query cannot be explained.');
}
- return new Response($this->container->get('twig')->render('@Doctrine/Collector/explain.html.twig', [
+ return new Response($this->twig->render('@Doctrine/Collector/explain.html.twig', [
'data' => $results,
'query' => $query,
]));
diff --git a/Resources/config/orm.xml b/Resources/config/orm.xml
index 0a735fe70..c3f25069b 100644
--- a/Resources/config/orm.xml
+++ b/Resources/config/orm.xml
@@ -233,5 +233,13 @@
+
+
+
+
+
+
+
+