Skip to content

Commit c7a2d00

Browse files
authored
Add ORM 3.6 commands for inspecting configured listeners (#2172)
1 parent 1b5a951 commit c7a2d00

2 files changed

Lines changed: 21 additions & 1 deletion

File tree

config/orm.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryCommand;
2222
use Doctrine\ORM\Tools\Console\Command\ClearCache\QueryRegionCommand;
2323
use Doctrine\ORM\Tools\Console\Command\ClearCache\ResultCommand;
24+
use Doctrine\ORM\Tools\Console\Command\Debug\DebugEntityListenersDoctrineCommand;
25+
use Doctrine\ORM\Tools\Console\Command\Debug\DebugEventManagerDoctrineCommand;
2426
use Doctrine\ORM\Tools\Console\Command\InfoCommand;
2527
use Doctrine\ORM\Tools\Console\Command\MappingDescribeCommand;
2628
use Doctrine\ORM\Tools\Console\Command\RunDqlCommand;
@@ -245,5 +247,17 @@
245247
->args([
246248
service('doctrine.orm.command.entity_manager_provider'),
247249
])
248-
->tag('console.command', ['command' => 'doctrine:schema:validate']);
250+
->tag('console.command', ['command' => 'doctrine:schema:validate'])
251+
252+
->set('doctrine.event_manager_debug_command', DebugEventManagerDoctrineCommand::class)
253+
->args([
254+
service('doctrine'),
255+
])
256+
->tag('console.command', ['command' => 'doctrine:debug:event-manager'])
257+
258+
->set('doctrine.entity_listeners_debug_command', DebugEntityListenersDoctrineCommand::class)
259+
->args([
260+
service('doctrine'),
261+
])
262+
->tag('console.command', ['command' => 'doctrine:debug:entity-listeners']);
249263
};

src/DependencyInjection/DoctrineExtension.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
use Doctrine\ORM\Mapping\MappedSuperclass;
3636
use Doctrine\ORM\Proxy\Autoloader;
3737
use Doctrine\ORM\Tools\AttachEntityListenersListener;
38+
use Doctrine\ORM\Tools\Console\Command\Debug\DebugEventManagerDoctrineCommand;
3839
use Doctrine\ORM\UnitOfWork;
3940
use Doctrine\Persistence\Mapping\Driver\MappingDriverChain;
4041
use Doctrine\Persistence\Mapping\Driver\PHPDriver;
@@ -776,6 +777,11 @@ private function ormLoad(array $config, ContainerBuilder $container): void
776777
$container->removeDefinition('doctrine.orm.entity_value_resolver.expression_language');
777778
}
778779

780+
if (! class_exists(DebugEventManagerDoctrineCommand::class)) {
781+
$container->removeDefinition('doctrine.event_manager_debug_command');
782+
$container->removeDefinition('doctrine.entity_listeners_debug_command');
783+
}
784+
779785
$controllerResolverDefaults = [];
780786

781787
if (! $config['controller_resolver']['enabled']) {

0 commit comments

Comments
 (0)