Skip to content

Add commands for inspecting configured listeners#12165

Merged
greg0ire merged 3 commits intodoctrine:3.6.xfrom
HypeMC:debug-events-commands
Dec 19, 2025
Merged

Add commands for inspecting configured listeners#12165
greg0ire merged 3 commits intodoctrine:3.6.xfrom
HypeMC:debug-events-commands

Conversation

@HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Sep 15, 2025

Related to doctrine/DoctrineBundle#2032

Similar to Symfony's debug:event-dispatcher command, this PR adds two new commands to inspect configured Doctrine event/entity listeners:

  • orm:debug:event-manager — lists event listeners registered in the Doctrine EventManager for a given entity manager (optionally filter by event).
  • orm:debug:entity-listeners — lists entity listeners configured for a given entity class (optionally filter by event).

@github-actions
Copy link
Contributor

There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days.
If you want to continue working on it, please leave a comment.

@github-actions github-actions bot added the Stale label Dec 15, 2025
@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 15, 2025

Still waiting for review 😄

@github-actions github-actions bot removed the Stale label Dec 16, 2025
Copy link
Member

@derrabus derrabus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those commands looks reasonable and helpful to me. WDYT @greg0ire?

}

/** @return MockObject&ManagerRegistry */
private function getMockManagerRegistry(): MockObject
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
private function getMockManagerRegistry(): MockObject
private function getMockManagerRegistry(): ManagerRegistry

Let's pick the more obvious type here and in the other tests.


use function assert;

abstract class AbstractCommand extends Command
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please flag this class as @internal. I don't want it to be used downstream.

@greg0ire
Copy link
Member

Those commands looks reasonable and helpful to me. WDYT @greg0ire?

I think so too.

@greg0ire
Copy link
Member

Can we get a few screenshots? Also, should the new commands be documented here?

@HypeMC HypeMC force-pushed the debug-events-commands branch from 81b11df to 47496ed Compare December 17, 2025 17:53
@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 17, 2025

@derrabus @greg0ire Hi, thank you for the review. All comments have been addressed in 47496ed.

Here are some screenshots as requested:
Screenshot from 2025-12-17 18-49-08

Screenshot from 2025-12-17 18-48-43 Screenshot from 2025-12-17 18-56-22 Screenshot from 2025-12-17 19-01-29

@greg0ire
Copy link
Member

Now that I'm seeing the result I'm thinking that maybe event should just be a column of one big table, rather than having many tables of length 1.

But I don't know how realistic your examples are.

@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 17, 2025

Now that I'm seeing the result I'm thinking that maybe event should just be a column of one big table, rather than having many tables of length 1.

But I don't know how realistic your examples are.

@greg0ire The listeners for each event are sorted by priority, which to me is one of the main benefits of these commands, being able to clearly see the execution order. Putting everything into one table would make that harder to read.

@greg0ire
Copy link
Member

greg0ire commented Dec 17, 2025

How about you add a table separator between each event, if this is a concern? You can even use a rowspan

+------------------------+-------+---------------------------------------------------------------------+
| Event                  | Order | Listener                                                            |
+------------------------+-------+---------------------------------------------------------------------+
| loadClassMetadataEvent | #1    | Doctrine\ORM\Tools\Pagination\LimitSubqueryWalker::addFilterToQuery |
|                        | #2    | App\EventListener\AuditListener::loadClassMetadata                  |
+------------------------+-------+---------------------------------------------------------------------+
| onFlush                | #1    | Doctrine\ORM\Tools\Pagination\LimitSubqueryWalker::addFilterToQuery |
+------------------------+-------+---------------------------------------------------------------------+
| onSchemaCreateTable    | #1    | Doctrine\ORM\Tools\Pagination\LimitSubqueryWalker::addFilterToQuery |
+------------------------+-------+---------------------------------------------------------------------+

@HypeMC HypeMC force-pushed the debug-events-commands branch from 4543032 to 3e25efd Compare December 17, 2025 22:17
@HypeMC
Copy link
Contributor Author

HypeMC commented Dec 17, 2025

@greg0ire Done, I think it looks better now:

Screenshot from 2025-12-17 23-21-13 Screenshot from 2025-12-17 23-23-37 Screenshot from 2025-12-17 23-21-29 Screenshot from 2025-12-17 23-21-55

@greg0ire
Copy link
Member

Gorgeous!

@greg0ire greg0ire added this to the 3.6.0 milestone Dec 19, 2025
@greg0ire greg0ire merged commit 9ae2181 into doctrine:3.6.x Dec 19, 2025
110 checks passed
@greg0ire
Copy link
Member

Thanks @HypeMC !

@HypeMC HypeMC deleted the debug-events-commands branch December 19, 2025 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants