-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Add an option to debug:container CLI command to see service usage #37413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Once i used something like that |
I used it too to generate a graph of the container 😄 to have a "big picture of the app structure" (PR here). Graphviz is amazing ! Initially I thought I would have to write a dumper myself, then I started typing the classname ... and my IDE told me there was a native GraphvizDumper inside Symfony 😁 (no idea what it's for but really useful) |
I used to dump the workflow for documentation purpose and one day I found this class for the container :) For me, maybe a new command appart should be added to leverage this dumper/grapher like the https://symfony.com/doc/current/workflow/dumping-workflows.html, not the debug:container And yes having the option to passe the fqdn or service id to only draw this service graph could be more precise :) |
Thank you for this suggestion. |
Since strict typing is becoming standard, I think the need for this will fade in time. Let's close this issue and let Symfony contributors focus on topics with a better ROI. |
…ut (Bert ter Heide, bertterheide) This PR was squashed before being merged into the 6.2 branch. Discussion ---------- [FrameworkBundle] Add "Usages" to debug:container output | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | Fix #37413 | License | MIT This feature adds "Usages" output to the debug:container command which allows a user to see which services require the requested service. Commits ------- e1ab83b [FrameworkBundle] Add "Usages" to debug:container output
Description
Quite often, I find myself in a situation where I need to update an existing Service in my Symfony application and I need to find "all the services relying on it" to update them.
So I have service
app.category.data_provider
and I want to see all other services that are being injected this instance.So I would like this to happen:
I think about making it optional because I expect the operation to be resources consuming, so no need to clutter the default
debug:container
Command with it.I have an idea about how to do it, but it's an expensive one: go through the full container graph and look for all declarations 😅 . I'm checking whether or not the idea is good by opening this issue before diving into the code and submitting a PR.
If the application is leveraging the power of auto-wiring and strict typing, the "find usage" search can be done by any good IDE. However on legacy applications, auto-wiring and strict typing are not that common ...
The text was updated successfully, but these errors were encountered: