Skip to content

Commit

Permalink
Moves ProfilerController service definition to dbal.xml (#1533)
Browse files Browse the repository at this point in the history
* adds failing test case for GH-1530

* moves ProfilerController service definition to dbal.xml

This makes the profiler controller available even when not using the
ORM.

Fixes GH-1530
  • Loading branch information
ju1ius authored Jun 6, 2022
1 parent 5523a81 commit eee859d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
8 changes: 8 additions & 0 deletions Resources/config/dbal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -104,5 +104,13 @@
<tag name="console.command" command="dbal:run-sql" />
</service>

<service id="Doctrine\Bundle\DoctrineBundle\Controller\ProfilerController">
<argument type="service" id="twig" />
<argument type="service" id="doctrine" />
<argument type="service" id="profiler" />

<tag name="controller.service_arguments" />
</service>

</services>
</container>
8 changes: 0 additions & 8 deletions Resources/config/orm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -233,13 +233,5 @@

<tag name="console.command" command="doctrine:mapping:import" />
</service>

<service id="Doctrine\Bundle\DoctrineBundle\Controller\ProfilerController">
<argument type="service" id="twig" />
<argument type="service" id="doctrine" />
<argument type="service" id="profiler" />

<tag name="controller.service_arguments" />
</service>
</services>
</container>
3 changes: 3 additions & 0 deletions Tests/DependencyInjection/AbstractDoctrineExtensionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Doctrine\Bundle\DoctrineBundle\Tests\DependencyInjection;

use Doctrine\Bundle\DoctrineBundle\Controller\ProfilerController;
use Doctrine\Bundle\DoctrineBundle\Dbal\BlacklistSchemaAssetFilter;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\CacheCompatibilityPass;
use Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DbalSchemaFilterPass;
Expand Down Expand Up @@ -448,6 +449,8 @@ public function testLoadLogging(): void
{
$container = $this->loadContainer('dbal_logging');

$this->assertTrue($container->hasDefinition(ProfilerController::class), 'ProfilerController should be available even when not using the ORM.');

$definition = $container->getDefinition('doctrine.dbal.log_connection.configuration');
$this->assertDICDefinitionMethodCallOnce($definition, 'setSQLLogger', [new Reference('doctrine.dbal.logger')]);

Expand Down

0 comments on commit eee859d

Please sign in to comment.